Add 'folder-monitor.ps1'
This commit is contained in:
parent
29c4ec7cf7
commit
e5701f8765
1 changed files with 24 additions and 0 deletions
24
folder-monitor.ps1
Normal file
24
folder-monitor.ps1
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# This script was made for use in conjunction with an RMM like SyncroMSP to monitor a folder for files added
|
||||||
|
# within the last 15 minutes. The script is run on a schedule by the RMM and once it detects files that have been
|
||||||
|
# added within the configured timeframe, it plays a series of system beeps on the host computer.
|
||||||
|
#
|
||||||
|
# The use case for this script was to call the user's attention to the newly added files even if they were a few
|
||||||
|
# feet away from their desk.
|
||||||
|
|
||||||
|
#Input the absolute path to the folder you want to monitor here:
|
||||||
|
$monitored_folder = ""
|
||||||
|
|
||||||
|
$files = Get-ChildItem -Path $monitored_folder -File | Where-Object { ((Get-Date) - $_.CreationTime).TotalMinutes -le 15 } | select Name, CreationTime
|
||||||
|
$filenames = $files.Name
|
||||||
|
if ($files) {
|
||||||
|
Write-Output "There were new files created: $filenames"
|
||||||
|
|
||||||
|
[System.Console]::Beep(300, 200)
|
||||||
|
[System.Console]::Beep(300, 200)
|
||||||
|
[System.Console]::Beep(300, 200)
|
||||||
|
[System.Console]::Beep(400, 600)
|
||||||
|
[System.Console]::Beep(500, 300)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Output "There are no new files"
|
||||||
|
}
|
Loading…
Reference in a new issue