Monthly Archives: July 2017

Comic Relief: Graph

Comic Graphic. Y axis = How Much this Graph makes sense. X axis = Time Spent Looking at this Graph. Line of graph is an endlessly repeating sine wave oscillating between 0 and 100%.

Happy Friday All!

Comic Credit: Abstruse Goose

How do I: Uninstall a SCOM agent that won’t uninstall

Back in the SCOM 2007 days there was a nice SCOM specific utility called MOMClean.exe that could be used to remove a corrupted agent which could no longer be removed via standard methods like add/remove programs or command line based uninstall. While I don’t come across corrupted agents very often when I do it is usually when a customer is trying to install an update release .msp file and the update mysteriously fails. More often than not the underlying issue is a corrupt agent, and when we try to repair/uninstall/reinstall the agent we hit a brick wall where the standard uninstall methods refuse to work.

There is no official Microsoft SCOM specific tool for cleaning up SCOM 2012/2016 agents, but you can still use a similar approach with a slightly different generic tool.

First go to:

Click Download:

Screen shot of page referenced in preceding text link with Download button highlighted in red.

Save the file:

Screen shot of download dialog box indicating file size of 216 KB and asking user if they would like to Open, Save, or Cancel.

Run the troubleshooting utility:

Screenshot of Downloaded executable file in windows explorer about to be accessed.

Click Next:

Screenshot of Program Install and Uninstall Troubleshooter interface. Looks for problems that can stop you installing and unistalling a program. Option to click Next or Cancel.

Select Uninstalling:

Screenshot: Text in window reads "Are you having a problem installing or uninstalling a program. There are two buttons one for each option. Uninstalling is highlighted with a Red Rectangle.

Select Microsoft Monitoring Agent – Click Next:

Screenshot: Program and Install troubleshooter, list of installed applications. Microsoft Monitoring Agent is selected. Option for Next or Cancel.

Select Yes, try uninstall:

Screenshot: Program Install and Uninstall Troubleshooter. Two options: Try Uninstall, or no try other fixes. Try uninstall is highlighted.

Wait impatiently:

Screenshot: Resolving problems, Attempting to uninstall Microosft Monitoring Agent with green horizontal scrolling progress bar.

And hopefully success:

Screenshot: Troubleshooting has completed. Close the troubleshooter is selected.

In a perfect world you should now be able to go into the SCOM console – delete the associated agent object, and then either rediscover and deploy a new agent, or manually install a new agent depending on how the agent was previously installed.

If reinstalling the agent fails after successfully running the uninstall tool you want to check the following:

Get-Service HealthService

Get-Service “System Center Management APM”

If the uninstall was successful you should see a message like “Cannot find any services with service name”

If the services are still present you can run the following to forcibly remove the services:

sc delete healthservice

sc delete “System Center Management APM”

You should also check the registry and confirm the following keys have been removed successfully:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Operations Manager
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\System Center Operations Manager

If you have confirmed all the above and you still can’t discover/install a new agent after deleting the old agent object from the console run the following T-SQL against the OperationsManager Database:

Use OperationsManager
DECLARE @GroomingThresholdUTC datetime
DECLARE @BatchSize int
SET @GroomingThresholdUTC = getutcdate()
SET @Batchsize = 250
EXEC dbo.p_DiscoveryDataPurgingByTypedManagedEntityInBatches @GroomingThresholdUTC, @BatchSize
EXEC dbo.p_DiscoveryDataPurgingByRelationshipInBatches @GroomingThresholdUTC, @BatchSize
EXEC dbo.p_DiscoveryDataPurgingByBaseManagedEntityInBatches @GroomingThresholdUTC, @BatchSize

Now try the install again and you should be all set.

Tagged , , ,