Hello,
I have some troubles with a custom file count script. The script should alert me when there is no new file in the directory for about 60 minutes.
Script:
$path = '\\server'
$stats = 0
$msg = ''
$days = 0
$hours = 3
$minutes = 0
$files = @(Get-ChildItem -Path $path)
if ($files -ne $null) {
$f_names = [System.String]::Join('|',$files)
$msg = 'Message: ' + $f_names
$stats = $files.Count
} else {
$msg = 'Message: 0 files exceed defined age'
}
Write-Host $msg
Write-Host "Statistic: $stats"
The main problem is, the script is working fine and also counts the files.
But I´m not sure how to setup the static threshold to get the notifications. Is there a way to use a variable or something like this int the warning /less than field or something like that ?
Thank you very much!