From e5701f8765b5a7dde6fd550b3f57339ed757635d Mon Sep 17 00:00:00 2001 From: wmellon Date: Tue, 5 Jul 2022 14:49:15 -0400 Subject: [PATCH] Add 'folder-monitor.ps1' --- folder-monitor.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 folder-monitor.ps1 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