diff --git a/folder-monitor.ps1 b/folder-monitor.ps1 new file mode 100644 index 0000000..5df2777 --- /dev/null +++ b/folder-monitor.ps1 @@ -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" +} \ No newline at end of file