Dirsync errors nad solutions: Event ID 0: Invalid namespace while automatic Sync or Start-OnlineCoexistenceSync, Object not found on the server

I have been facing errors with one of my customers lately. There is hybrid deployment with Exchange on premise and Office 365 with ADFS.

Symptoms:

  • Dirsync stopped to work, because automatic synchronization started to throw invalid namespace errors (Event ID 0)
  • DirSync cannot be run via Start-OnlineCoexistenceSync
  • Dirsync could run manually from GUI

invalid namespace

Cause:

When DirSync is installed on the server, after its configuration DirSync installator creates a service, which by default run synchronization every 3 hours to populate changes of local AD´s objects to the cloud and if Hybrid deplouyment checkbox is ticked during configuration, it also updates few attributes in opposite direction (From Cloud -> On premise).

Behind the scenes this service also creates performance counters to WMI and this is also the problem! In my case CCM agent´s (installed by SCCM) old version has been uninstalled and during uninstallation of CCM agent the repository of WMI has been corrupted. This caused the FIM Synchronization service to fail to run.

Solution:

The solution is not easy and here are the steps need to be run in the following order to make it work and make it work permanenty:

  • Fix MOF files – MOF files are used to register performance counters to WMI. These files can be registered once per product installation or everytime the product upgrades and this is problem. Dirsync Product has by default MOF files, which are registered only once and not during upgrades. This problems come up when CCM agent is uninstalled and MOF files are not re-registered. To prevent this to happen again add the following text to the first line of MOF files for dirsync product:

MOF file location:
%Program Files%\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\Bin

MOF files name:
mmswmi.mof

mmswmi-x.mof is used for product uninstallation. Do not change it.

 #PRAGMA AUTORECOVER
//********************************************************
//*                                                      *
//*   Copyright (C) Microsoft. All rights reserved.      *
//*                                                      *
//********************************************************
//
// mmswmi.MOF
//
//===================================================================

  • Repair WMI repository permanently

To repair WMI you must run the following command from the same location as previous step and restart FIM Synchronization service. The result should be “Done!”

mofcomp mmswmi.mof
  • Re-Register FIM Sync Service DLL and restart win management service

From the same location under elevated permissions run:

regsvr32 /s mmswmi.dll
net stop winmgmt
net start winmgmt
  • Re-Run configuration of DirSync

From the location %Program Files%\Windows Azure Active Directory Sync run ConfigWizard.exe

If you receive the following error, move service accounts (MSOL* to OU=Users in root domain of your Onpremise AD)

No object on server