How to completely remove Exchange Connector’s instances in Service Manager 2012
When you delete Exchange Connector management pack without prior deleting the connector’s instances, you get the orphaned connectors in the SCSM console that you cannot delete. Even after you import the Exchange Connector management pack back, the situation stays as bad as before.
I’ve recently participated in the discussion on the TechNet forum about removing orphaned Exchange Connector’s instances from SCSM 2012. Despite all advices about removing Microsoft.SystemCenter.Connector class instances it doesn’t entirely help because in the system there are not only Microsoft.SystemCenter.Connector instances (to be frank, the connector’s class is actually based on System.LinkingFramework.DataSource that derives from Microsoft.SystemCenter.Connector) but also rules specified in ServiceManager.LinkingFramework.Configuration management pack that holds all rules for all connectors.
This is a very usual situation with Exchange Connector. Let’s fix that. We will use SMlets as we often do.
Run PowerShell shell as an administrator, then type:
Import-Module smlets
Now we start removing all instances of Exchange Connector. For instance, if you have an instance of Exchange Connector named ‘Exchange connector’, you have to run the following command:
Get-SCSMObject -class (Get-SCSMClass -name System.LinkingFramework.DataSource) -filter "DisplayName -like 'Exchange connector'" | Remove-SCSMObject -force -verbose
If you have an instance of Exchange Connector named ‘veryannoyingconnector’, then:
Get-SCSMObject -class (Get-SCSMClass -name System.LinkingFramework.DataSource) -filter "DisplayName -like 'veryannoyingconnector'" | Remove-SCSMObject -force -verbose
So, please delete all connectors and let’s start removing the rules because without that you will get the Operations Manager’s log full of red alerts. The solution is very very simple as it must be. Just run the following two strings of PS code.
Get-SCSMRule | ?{$_.Name -like 'ExchangeConnector.*'} | %{$_.Status = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementStatus]::PendingDelete}
(Get-SCSMManagementPack -Name ServiceManager.LinkingFramework.Configuration).AcceptChanges()
Congratulation! Now you are free of Exchange Connector.
P.S. If PowerShell commands fail, please retype all dashes. It's a well-known issue when you copy PS commands from the internet browsers.
P.P.S. Needless to say that when you uninstall SCUtils Email Connector, the wizard politely and silently remove all the connector’s instances. We care, you know :)