SharePoint Crawl Search PS monitor in SCOM

I have created this PS monitor using community MP but state always shows healthy even when SharePoint crawl search is Paused, please help, if I am missing anything.

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

$State = Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchCrawlContentSource

$PropertyBag.AddValue(“State”,$State)

$PropertyBag

Hi ,

does the monitor run on the server you would like to monitor?

For a test I suggest you log your result into a text file or into the SCOM log:

Share your result :slight_smile:

thanks for your reply, looks like you can only run this cmd from SharePoint Management Shell not form PS Window,