Exchange WMI Errors – WMI Repository Clear & Reinstall Script

Finally found the solution to fix the “An error occured during a call to Windows Management Instrumentation ID no: 8004100e Exchange System Manager” error. It worked beautifully. I can now fully utilise Message Tracking on my Windows 2000 Exchange server.
I have to give full credit to Luke Edson at http://www.mrtweak.com/exchange-ser…install-script/
In essence, it incompases the solution given by Danielp ealier, but goes a little further. Just run this script:

net stop winmgmt /y
c:
cd %windir%\system32\wbem
rd /S /Q repository
regsvr32 /s %systemroot%\system32\scecli.dll
regsvr32 /s %systemroot%\system32\userenv.dll
mofcomp cimwin32.mof
mofcomp cimwin32.mfl
mofcomp rsop.mof
mofcomp rsop.mfl
for /f %%s in (’dir /b /s *.dll’) do regsvr32 /s %%s
for /f %%s in (’dir /b *.mof’) do mofcomp %%s
for /f %%s in (’dir /b *.mfl’) do mofcomp %%s
mofcomp -n:root\cimv2\applications\exchange wbemcons.mof
mofcomp -n:root\cimv2\applications\exchange smtpcons.mof
mofcomp exmgmt.mof
mofcomp exwmi.mof
net start winmgmt

More on the issue:

The error code 8004100e translates to WBEM_E_INVALID_NAMESPACE, which means
the failure is due to an invalid namespace.

To resolve this issue, we will need to attempt registration of the
necessary DLLs and to import the Exchange Namespaces and Classes. Running
the below commands will harm nothing if the DLLs are already registered or
if the Namespaces and/or Classes are already present in the WMI Repository.

1. Run the following command from a command prompt in the Program
Files\Exchsrvr\Bin directory:

regsvr32 /s exwmi.dll
regsvr32 /s cdowf.dll
regsvr32 /s cdowfevt.dll

2. Run the following commands from a command prompt in the
Windows\System32\Wbem directory:

mofcomp.exe -class:forceupdate C:\WINDOWS\system32\WBEM\exmgmt.mof
mofcomp.exe C:\WINDOWS\system32\WBEM\exwmi.mof
mofcomp.exe -n:root\cimv2\applications\exchange
“C:\WINDOWS\system32\wbem\wbemcons.mof”
mofcomp.exe -n:root\cimv2\applications\exchange
“C:\WINDOWS\system32\wbem\smtpcons.mof”
mofcomp.exe -n:root\cimv2\applications\exchange
“C:\WINDOWS\system32\wbem\msgtrk.mof”

3. Restart the Windows Management Instrumentation service and all related
services.

If the issue still persists, that files in the
%SystemRoot%\System32\Wbem\Repository folder may get corrupted. Let’s
perform these steps:

1. Click Start, and then right-click My Computer.

2. On the shortcut menu, click Manage.

3. In the left pane of the Computer Management console, double-click
“Services and Applications”.

4. Under “Services and Applications”, click Services.

5. In the right pane of the Computer Management console, locate and then
right-click Windows Management Instrumentation.

6. On the shortcut menu, click Stop.

7. Start Windows Explorer, and then locate the
%SystemRoot%\System32\Wbem\Repository folder.

8. Copy %SystemRoot%\System32\wbem\Repository to a different folder and
then delete all of the files in the %SystemRoot%\System32\Wbem\Repository
folder.

9. Register all DLLS in %SystemRoot%\System32\wbem. To do so, run the
following commands:

cd C:\WINDOWS\system32\wbem
for /f %s in (‘dir /b *.dll’) do regsvr32 /s %s

10. Restart the computer. The files that were deleted are re-created when
the computer restarts as the Windows Management Instrumentation service
starts automatically when you restart the computer.

Hope above information helps! I am happy to be of assistance to you and
look forward to your reply.

Bad Behavior has blocked 149 access attempts in the last 7 days.