I like to use the great PowerShell tools provided by Lithnet on my MIM instances. Yesterday I discovered I couldn’t start the management agents using Start-ManagementAgent and all I got back was “Invalid Namespace”. After a bit of digging it turned out to be that the MIM WMI namespace had unregistered itself somehow.
Fixing that was quite simple but needed a slight adaptation of the advice from here: http://www.apollojack.com/2009/04/cannot-connect-to-mms-wmi-service.html
regsvr32 "C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Bin\mmswmi.dll"
mofcomp -N:root\MicrosoftIdentityIntegrationServer "C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Bin\mmswmi.mof"