Share via


Remove-DisabledMonitoringObject

Before I dive into the mechanics of removing discovered inventory, I want to attempt a quick definition of this cmdlet and it's intended use.

An object (MonitoringObject) is an instance of a class (MonitoringClass). So, if an object is removed (Remove-DisabledMonitoringObject) from discovered inventory, monitoring defined for (targeting) that class will not be delivered to that object. Because, as far as that MonitoringClass is concerned, that MonitoringObject does not exist.

A couple reasons why this cmdlet is useful.

1.  It enables us to quickly remove discovered objects, in order to remove these instances from being included in workflows from a MP, instead of going through a mountain of rules and monitors and creating disable overrides.

2.  It enables us to cleanup discovered objects.  For example - we create a group of agents to include in AD Client Monitoring after the ADMP is imported.  Down the road, it is decided that we don't want some of those agents to participate in AD Client Monitoring.  So we remove a few agents from the group, but the discovered objects remain...hence, the AD Client Monitoring workflow is still delivered to that agent.  We need to run the cmdlet to finish the job.  A little more about this at the end.

For this example, I will be removing AD Client Monitoring objects.  This example assumes you have ADMP imported with some agents enabled for AD Client Monitoring.  However, the steps are the same for any kind of inventory you wish to remove.

First, open up the console and take a look at the Monitoring pane > Discovered Inventory.  In the Action pane, click Change target type.  Select Active Directory Client Perspective.

actions

 

As you can see, I have 8 agents enabled for Client Perspective.  In this example, I'd like to remove 3 of these objects.

01 - Discovered Inventory 1

 

What I need to do here, is go into the Authoring pane > Object Discoveries.  Scope to Active Directory Client Perspective.  As you see, the discovery is targeting Windows Computer.  This is what we need to target to remove the discovered objects.

02 - Object Discovery for AD Client Perspective

 

Now, we could go ahead and disable override for specific agents.  But, if you have more than a handful, you might consider creating a group.  Either way, we're going to need to target Windows Computer in order for this to work.

 

I'm creating a group, targeting Windows Computer, and adding my 3 explicit members.

03 - Create group targeting Windows Computer class

 

After our group is created, let's go back to Authoring > Object Discoveries.  Override the discovery for a group.  In the override, select the Enable parameter and change to False.  Remember to save to your MP (not default MP).

04 - Override for group

 

Now, open Operations Manager Command Shell and run

Remove-DisabledMonitoringObject

 

There is no indication in the cmdlet that anything really happened.  But, if you go back to the Monitoring pane > Discovered Inventory, you'll notice that the inventory has disappeared.  This is fairly instantaneous.  If your inventory is still there, go to step one :)

05 - Discovered Inventory 1

 

A little tip on removing discovered objects for optional discovery rules.  Let's say...AD Client Monitoring!  As we know, this discovery is not enabled by default.  We create a group and apply an enable override to it, in order to get AD Client Monitoring to the agent.  One might think that in order remove AD Client Monitoring from a couple agents down the road, we may just remove those couple of agents from the group and run the Remove-DisabledMonitoringObject cmdlet.  Because the discovery is not enabled by default...right?

Unfortunately, that's not the case.  I'll explain why. 

Remove-DisabledMonitoringObject will only remove inventory that has already been discovered, for objects that have an override for Enable = FALSE explicitly for the discovery rule. In this case, an object has been discovered by enabling the discovery rule for it by setting override Enable = TRUE. If you were to remove the override for that object, it would go back to its default setting…which is “not configured”. In essence, it “tattoos” the setting. In order for Remove-DisabledMonitoringObject to work, the object needs to have an override Enable = FALSE to explicitly disable the discovery rule and for Remove-DisabledMonitoringObject to work.

So, you'll still need to remove these objects from the original group you created to enable their discovery.  From there, you can follow two paths.

1.  We could create a group, populate it with only those objects we want to remove, disable override the discovery for that group, and run the cmdlet.  Then, to keep things nice and tidy, we need to delete our group we just created to remove those agents.  But that's a lot of work!

2.  Change the enable parameter for our original discovery override to false, run the cmdlet.  Then change the enable back to true.  This will, in effect, remove all disabled monitoring objects from discovered inventory then add them back...but this time, without the objects you intend to remove.

I hope I made sense out of removing optional discovery rule inventory...

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    We received an important reminder today from the product group about manually editing the database, and

  • Anonymous
    January 01, 2003
    Well first of all I really encourage you to upgrade to OM 2012 because it really brings a lot of features

  • Anonymous
    January 01, 2003
    @Sergey - Unfortunately, even if I had a solution for this I could not publish it, because this would go directly against product group support statement

  • Anonymous
    January 01, 2003
    Any thoughts on those computers which are discovered under AD Topolgy discovery but still does not removed after enabling discover agent only option as override. So tried by disabling the discovery rule for AD topology and ran this cmdlet many times. Also mofied the interval tovery  frequent in discovery rule before running the cmdlet.

  • Anonymous
    January 01, 2003
    I believe it is Remove-SCOMDisabledClassInstance

  • Anonymous
    January 01, 2003
    Hi Ramila, If any objects are in a grey "state", this means that monitoring workflows targeting that object are not running due to some issues with the Health Service.  It usually comes down to the Health Service not running, or the computer is unresponsive or unreachable. -Jonathan

  • Anonymous
    January 01, 2003
    @great - yes, some of these cluster deletion issues were resolved in the CU's. @Andre's - I haven't heard any issues with this cmdlet not working as described.  Make sure you have the discoveries disable for the instances you want to delete.  I don't have experience removing x-plat instances, though, so maybe you would find the Technet forums more helpful in that area. social.technet.microsoft.com/.../systemcenteroperationsmanager

  • Anonymous
    January 01, 2003
    Hi Ramila, There are plenty of discussions in the forums and blogs around how to troubleshoot grey agents.  The first step is to restart the Health Service on the Agent and look in the Operations Manager event log for any warning and error events.  Anything beyond that would need to be taken up in a forum with your peers.  Sorry, I can't help much here in the comments of this post. Try here: http://social.technet.microsoft.com/Forums/en-US/category/systemcenteroperationsmanager -Jonathan

  • Anonymous
    January 01, 2003
    Hi - The product group specifically asks that we do not ever remove discovered inventory by updating the database directly.  They say this will cause corruption eventually.  Even though this appears to remove the object, it is not recommended.  I would suggest using the Technet forums for further advice.  If you cannot get the results you seek there, then I suggest opening a case with Microsoft to resolve the issue.

  • Anonymous
    January 01, 2003
    Shindhe, That's right.  Remove-DisabledMonitoringObject removes inventory that was discovered where the discovery enabled property has been set to False (aka, disabled). -Jonathan

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Hi Jonathan! Do you know how to remove disabled monitoring objects directly from Operations Manager Database (by sql query)? Thank you!

  • Anonymous
    January 01, 2003
    Thanks Jonathan. Yes, i have verified that management server action account is a member of SCOM administrator. I do not see any errors or information of powershell script also. I ran get-agent command to verify that agent is not in list and even verified the directory for powershell as well.

  • Anonymous
    January 01, 2003
    I want to un-discover a number of SQL 2008 servers. I have created a group containing the 'Windows Computers' I am interested in. I have then searched the Object Discoveries for SQL Server 2008. There are 18 discoveries returned.....! DoI need to set the override against each of these 18 discoveries? If so, will the group I have previously set up that contains the SQL Server 2008 'Windows Computers' be sufficient or should I be creating more specific groups.    Seems an awful lot of work just to simply undiscover an occurence of a SQL Server 2008 server. Thanks M

  • Anonymous
    January 18, 2010
    I wonder to know that whay some time  the in the Discovered Inventory the state of the comuter is gry but insted of green?

  • Anonymous
    January 18, 2010
    Thanks. Jonathan. your answer was so helpfull. I wonder to know that how can I fix the problem? what is  the next step If I want to solve this problem ?

  • Anonymous
    June 24, 2010
    Wonderful info!!! Remove-DisabledMonitoringObject will only remove inventory that has already been discovered, for objects that have an override for Enable = FALSE explicitly for the discovery rule but what happens when we upgrade the MP from one version (Enable = FALSE) to another version (ENABLE = TRUE) still the Remove-DisabledMonitoringObject works i suspect because in our case it's not removing the lingering instances of previous version.

  • Anonymous
    March 24, 2011
    great help!!  i was suffering after shutting down a cluster, several gray resources groups. Anyway i think this issue is solved with CU2, can you confirm this please? Thanks.

  • Anonymous
    March 30, 2011
    I'm trying to use this cmdlet and it seems that is not working properly. First of all, it seems that arguments -WhatIf and -Confirm are not working at all. Apart from this issue, the cmdlet is not deleting objects in some circustances. I'm trying to remove some Solaris 9 Logical Disks discovered by the Solaris 9 Operative System MP without success. Has anyone else had problems removing discovered objects?

  • Anonymous
    September 12, 2011
    The comment has been removed

  • Anonymous
    September 26, 2011
    i tried every thing, but my  specific computer did not have any discovery rules related. I also did a manual database grooming but the computer stil shows up in the console. I ended up by brutaly removing the computer from the database with: UPDATE [OperationsManager].[dbo].[BaseManagedEntity] SET [IsDeleted] = 1   WHERE [DisplayName] LIKE 'myserver.me.com' This seems to work. Do you have any recommendations on this? It seems to be the wrong way, but it looks like i have no other option. thanks in advance, Marthijn

  • Anonymous
    October 13, 2011
    The comment has been removed

  • Anonymous
    November 25, 2011
    The comment has been removed

  • Anonymous
    November 27, 2012
    Any idea what the "Remove-DisabledMonitoringObject" PS command is in SCOM 2012?