I have this powershell script that checks the age of a folder on one of our VMs:
If the age of the folder goes 30 minutes without being updated, it should return a "1".
$Folder = "PATH GOES HERE"[datetime]$nowTime = Get-Date$parentAge = Get-ItemProperty -Path $folder | select lastwritetime -ExpandProperty lastwritetime$thirtyMinutes = (get-date).AddMinutes(-30)if ($parentAge -le $thirtyMinutes) {#transfers hung upWrite-Host 'Statistic.Result: 1'}elseIf($parentAge -ge $thirtyMinutes) {#successful transferswrite-host 'Statistic.Result: 0'}else {Write-Host 'Statistic.Result: 2'}However, it never gets passed the first if statement. I can run it on my own machine and it works.
Things I have tried:
Ran the script on my main poller under our Orion Service Account (has correct privileges) - this works
ran the script under multiple accounts that have correct privileges (including my own domain) - doesn't work
anyone know what's going on here? any help is greatly appreciated.