I just upgraded to 2020.2. Post upgrade two of my SAM monitors quit working. Both are powershell scripts that monitor age of files on a remote server. When I edit the application and then edit the script. I run the get output and it does not return the correct value. If I copy the script in PowerShell ISE and run it directly on the SolarWinds orion server I get the correct value.
These scripts worked flawlessly until the upgrade today. Has anyone had this issue after upgrading. Here is an example of the very basic powershell script.
$fullPath = "\\servername\ILS\Interface\Input\*.*"
$numdays = 0
$numhours = 0
$nummins = 15
function ShowOldFiles($path, $days, $hours, $mins)
{
$files = @(get-childitem $path -include *.* | where {($_.LastWriteTime -lt (Get-Date).AddMinutes(-$mins)) -and ($_.psIsContainer -eq $false)})
if ($files -ne $NULL)
{
for ($idx = 0; $idx -lt $files.Length; $idx++)
{
$file = $files[$idx]
Write-Host 'Statistic: ' $file.count;
}
} else
{
Write-Host 'Statistic: ' 0;
}
}
ShowOldFiles $fullPath $numdays $numhours $nummins
Thanks,