I'm trying to run the following Powershell script automatically in PRTG.
$password = Get-Content C:\securestring.txt | convertto-securestring $username = $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://prod-exch1.prod.local/PowerShell/ -Credential $credentials Import-PSSession $session -DisableNameChecking Write-Host "<prtg>" foreach ($mbx in Get-Mailbox) { #$name = (Get-MailboxStatistics $mbx.Identity).DisplayName $name = $mbx.PrimarySMTPAddress $used = (Get-MailboxStatistics $mbx.Identity).TotalItemSize Write-Host "<result>" "<channel>$name</channel>" "<value>$used</value>" "<unit>Custom</unit>" "<CustomUnit>MB</CustomUnit>" "<VolumeSize>MegaByte</VolumeSize>" "<float>1</float>" "</result>" } Write-Host "</prtg>" Write-Host 0:OK Exit 0
The timeout being set to 300 seconds and the scanning interval to 4 hours. It times out with the error code PE018 every time.
The script runs as expected using the Powershell console
Add comment