Showing results for 
Search instead for 
Did you mean: 
Create Post

Trying to montior files in an SMTP queue for age of 15 mins or longer

I am trying to Monitor my SMTP queue on my windows 2012 r2 server

when I use the following script i get an output of 1 in powershell.

$file= Get-ChildItem -Path 'c:\inetpub\mailroot\queue' | ?{$_.LastWriteTime -lt (Get-Date).Addminutes(-15)}
Write-Host "Statistic: $stats"

When i move it over to SAM Powershell Script Monitor I get the following message


Output: ==============================================
Statistic: 0

Errors: ==============================================
Get-ChildItem : Cannot find path 'C:\inetpub\mailroot\queue' because it does not exist.
At line:2 char:8
+ $file= Get-ChildItem -Path 'c:\inetpub\mailroot\queue' | Where-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\inetpub\mailroot\queue:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
I found out that it is running this powershell script on the Solarwinds server instead of the target server any ideas on how to resolve that?
0 Kudos
1 Reply

In your PowerShell script component monitor settings, check the box to run the script remotely. You're getting this error because the script is running locally on the Orion server.

0 Kudos