Thursday, March 1, 2012

Invalid Discovery Source

Today I run into an issue when I tried to remove discovered objects from SCOM 2012 RC using the Remove-SCOMDisabledClassInstance CMDLET.

You can use this command to remove previous discovered instances. Before that you have to disable the discovery for the objects you like to remove by using the specific override. Be careful, you should really know what you do!

The issue mentioned above occurred when I fired the CMDLET in the Operations Manager (Power) Shell. Here is the output, I highlighted the important part regarding this problem:

PS C:\> Remove-SCOMDisabledClassInstance
**WARNING** This operation WILL result in class instances and relationships being permanently deleted.  This operation i
s irreversible and will likely result in a significant amount of activity in the operational database.  Are you sure you
want to do this? [Y/N]
y
Started.  This operation make take a very long time to complete.
Remove-SCOMDisabledClassInstance : Discovery data generated by invalid discovery source. Id:8F02035B-FDFE-690F-9E62-FA8D4EF0F73E.
At line:1 char:33
+ Remove-SCOMDisabledClassInstance <<<<
    + CategoryInfo          : InvalidOperation: (Microsoft.Syste...nstancesCommand:RemoveSCDisabledClassInstancesComma
   nd) [Remove-SCOMDisabledClassInstance], DiscoveryDataIn...SourceException
    + FullyQualifiedErrorId : ExecutionError,Microsoft.SystemCenter.OperationsManagerV10.Commands.RemoveSCDisabledClas
   sInstancesCommand

Here is my workaround for that. Please be aware that this is completely unsupported and should not be used when you don’t know what you are doing!

I fired the query below against my Operations Manager DB to find the Discovery source:

USE OperationsManager
SELECT *
FROM [OperationsManager].[dbo].[DiscoverySource]
where DiscoveryRuleId = '8F02035B-FDFE-690F-9E62-FA8D4EF0F73E'
GO

Check if the TimeGeneratedOfLastSnapshot is pretty old. Get the DiscoverySourceId for the next step. Then I verified if there is an existing relationship for this particular DiscoverySource:

USE OperationsManager
SELECT *
FROM [OperationsManager].[dbo].[DiscoverySourceToRelationship]
where DiscoverySourceId = '<the DiscoverySourceId from the query above>'
GO

Because there is no relationship it seems that the DiscoverySource has not been removed successfully.

So the next step is to update the DiscoverySource table and set the IsDeleted column for the DiscoveryRuleId from the first query to “1”. Because this is really not supported I will not provide the statement here. I’m sure you find it by your own and if not: kids, don’t try that at home (or at work)!

Done that the CMDLET should run successful (as long as there are no problems with other discovery sources):

PS C:\> Remove-SCOMDisabledClassInstance
**WARNING** This operation WILL result in class instances and relationships being permanently deleted.  This operation i
s irreversible and will likely result in a significant amount of activity in the operational database.  Are you sure you
want to do this? [Y/N]
y
Started.  This operation make take a very long time to complete.
Completed.  The operations took 0 hours and 1 minutes to complete.

All information is provided "as is" without any warranty! Try in lab before. Handle with care in production.

0 Comments:

Post a Comment