Hello, i have created powershell monitoring script but looks like it does work properly on target machine.

$ScomAPI = New-Object -comObject “MOM.ScriptAPI”
$PropertyBag = $ScomAPI.CreatePropertyBag()

function RegisterSnapIn($snapIn, $visibleName)
if(Get-Module $snapIn)

$nstPath = “HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\130\Service”

$snapInAssembly = Join-Path (Get-ItemProperty -path $nstPath).Path “\$snapIn.psd1”
if(!(Test-Path $snapInAssembly)) { $snapInAssembly = Join-Path (Get-ItemProperty -path $nstPath).Path “\$snapIn.dll” }
Import-Module $snapInAssembly -ErrorVariable errorVariable -ErrorAction SilentlyContinue
if (Check-ErrorVariable -eq $true)
if ((Get-PSSnapin -Name $snapIn -ErrorAction SilentlyContinue) -eq $null)
if ((Get-PSSnapin -Registered $snapIn -ErrorAction SilentlyContinue) -eq $null)
write-host -fore Red “Couldn’t register $visibleName”
write-host -fore Red “Some cmdlets may not be available`n”
Add-PSSnapin $snapIn
function Check-ErrorVariable
return ($errorVariable -ne $null -and $errorVariable.Count -gt 0)

RegisterSnapIn “Microsoft.Dynamics.Nav.Management” “Microsoft Dynamics NAV Management Snap-in”
RegisterSnapIn “Microsoft.Dynamics.Nav.Apps.Management” “Microsoft Dynamics NAV App Management Snap-in”

$State=Get-NAVTenant -ServerInstance Dev1|select State


# Send output to SCOM



I have tried to use $PropertyBag.AddValue(‘state’,$State)

but with this I got error The Microsoft Operations Manager Expression Filter Module failed to #query the delivered item, item was dropped.

Property Expression: Property[@Name=’state’]

The script itself, started from powershell console, works fine on target machine.

In Windows Powershell log i can see that powershell starting every 2 mins, right on schedule.

Right now the state is Mounted and it should be Critical, but it is Marked as Healthy.


Skovsen answered