Error running Remove-DisabledMonitoringObject in System Center Operations Manager
I’ve been experimenting with SCOM for a project I’m doing. One of the things that people frequently complain about in SCOM is that when you enable a management pack those monitors are enabled for EVERY SINGLE MACHINE it discovers. Annoying right? Well turns out you can work around this. Here’s what you have to do:
- Create a group under Authoring and assign it to a new Management Pack (DO NOT USE THE Default Management Pack.. you probably know this already though.)
- Go to object discoveries and override the rules you don’t want active for servers in your group.
- Add servers to your group.
- Open the Operations Powershell Console and run the command: Remove-DisabledMonitoringObject
What this does is tells SCOM not to discover these services/monitors on this group of servers. Then we run the powershell command because it tells SCOM to remove the monitors for any objects that are now disabled because otherwise these servers were already discovered and are already being monitored.
What’s great about this method is that later if you decide you want to monitor these servers for these rules afterall, you can just move them out of your group, they’ll get discovered and then monitored!
Where the error happens
If you’re like me, you probably enabled a bunch of rules and moved a bunch of machines into that group and then ran the command and then got an error message like:
Remove-DisabledMonitoringObject : Microsoft.EnterpriseManagement.Common.Discover
taFromRuleTargetedToDeletedMonitoringObjectException: Discovery data has been re
ved from a rule targeted at a non-existent monitoring object id.
At line:1 char:32
+ Remove-DisabledMonitoringObject <<<<
+ CategoryInfo : InvalidOperation: (Microsoft.Enter…ingObjectCmdl
:RemoveDisabledMonitoringObjectCmdlet) [Remove-DisabledMonitoringObject], Dis
+ FullyQualifiedErrorId : ExecutionError,Microsoft.EnterpriseManagement.Oper
It’s at this point you’re probably scratching your head wondering what the heck is wrong with your install? Well, don’t worry.. The problem is that you have too many items getting executed at the same time. I’m not sure if it’s too many machines, too many rules or a combination thereof, but what I do know is that to get around this error you have two options:
- Reduce the number of machines you’re adding to your group and the command will execute without error.
- Just keep running it. It is doing what it’s supposed to do so just keep running it until you get no more errors after a run.
Anyway, I wasted a ton of time on this one so I hope this post helps someone else waste less time.0