EXEXML Sensor returns PE231. I am trying to use a custom powershell script to return useful information on DAG status. The script runs fine when manually executed but I get the aforementioned error. Any advice appreciated. have checked a similar thread but that fix didn't seem to work for me. Here's the script below:
#[CmdletBinding()] #Param( # [Parameter()] # [switch]$Active, # [Parameter(Mandatory=$True)] # [string]$MBServer, # [Parameter(Mandatory=$True)] # [string]$MBDatabase #) $Active = $args[0] $MBServer = $args[1] $MBDatabase = $args[2] Function LoadExchangeSnapin { if (! (Get-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction:SilentlyContinue) ) { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 } } Function StatusValue($CopyStatus) { If ($Active) { Switch ($CopyStatus) { "Mounted" {2} "Healthy" {1} default {0} } } Else { Switch ($CopyStatus) { "Healthy" {2} "Mounted" {1} default {0} } } } LoadExchangeSnapin Write-Host "<?xml version=`"1.0`" encoding=`"Windows-1252`" ?>" Write-Host "<prtg>" $Databases = Get-MailboxDatabaseCopyStatus -Server $MBServer ForEach ($Database in $Databases) { if ($MBDatabase -contains $Database.name) { $a = $Database.Status $b = $Database.CopyQueueLength $c = $Database.ReplayQueueLength $d = $Database.ContentIndexState $status = StatusValue($a) Write-Host "<result>" Write-Host "<channel>Status</channel>" Write-Host "<unit>Status</unit>" Write-Host "<mode>Absolute</mode>" Write-Host "<showChart>1</showChart>" Write-Host "<showTable>1</showTable>" Write-Host "<warning>0</warning>" Write-Host "<float>0</float>" Write-Host "<value>$status</value>" Write-Host "<LimitMinWarning>1</LimitMinWarning>" Write-Host "<LimitWarningMsg>Status not Expected</LimitWarningMsg>" Write-Host "<LimitMinError>0</LimitMinError>" Write-Host "<LimitErrorMsg>Status not Expected</LimitErrorMsg>" Write-Host "<LimitMode>1</LimitMode>" Write-Host "</result>" Write-Host "<result>" Write-Host "<channel>Copy Queue Length</channel>" Write-Host "<unit>#</unit>" Write-Host "<mode>Absolute</mode>" Write-Host "<showChart>1</showChart>" Write-Host "<showTable>1</showTable>" Write-Host "<warning>0</warning>" Write-Host "<float>1</float>" Write-Host "<value>$b</value>" Write-Host "</result>" Write-Host "<result>" Write-Host "<channel>Replay Queue Length</channel>" Write-Host "<unit>#</unit>" Write-Host "<mode>Absolute</mode>" Write-Host "<showChart>1</showChart>" Write-Host "<showTable>1</showTable>" Write-Host "<warning>0</warning>" Write-Host "<float>1</float>" Write-Host "<value>$c</value>" Write-Host "</result>" Write-Host "<result>" Write-Host "<channel>Content Index State</channel>" Write-Host "<unit>State</unit>" Write-Host "<mode>Absolute</mode>" Write-Host "<showChart>1</showChart>" Write-Host "<showTable>1</showTable>" Write-Host "<warning>0</warning>" Write-Host "<float>0</float>" if ($d -eq "Healthy") { Write-Host "<value>1</value>" } else { Write-Host "<value>0</value>" } Write-Host "<LimitMinError>0</LimitMinError>" Write-Host "<LimitErrorMsg>Content Index is Not Healthy</LimitErrorMsg>" Write-Host "<LimitMode>1</LimitMode>" Write-Host "</result>" } } Write-Host "</prtg>"
Add comment