Rebuild WMI

My upgrade to SCCM SP1 went very smoothly, overall. However, luckily (ßsarcasm) for me, I inherited a bunch of Server 2003 R2 Distribution Points. Over the years, these servers have been so haphazardly patched, upgraded, downgraded and mangled that their mothers wouldn’t even recognize them. Naturally, they decided to barf all over the place after I upgraded the client agent on each machine.

Every time I logged into one, WMI would throw out the very helpful (ßsarcasm again) error blurb about how WMI doesn’t want to play anymore and wants its toys back:

Image

Obviously, I could do the whole stop winmgmt, rename the repository directory, blah blah stuff and things. However, I was not certain that would fix my issue at all, given the neglect that these servers have seen over the years. So, I searched high and low and came across a very good script that allowed me to re-register the dll files I needed and compile them whilst rebuilding what I would have done manually. The script is as follows (copy and save as .cmd):

net stop winmgmt

pause

c:

cd c:\windows\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 exwmi.mof

mofcomp -n:root\cimv2\applications\exchange wbemcons.mof

mofcomp -n:root\cimv2\applications\exchange smtpcons.mof

mofcomp exmgmt.mof

If you run into errors during this script, you may have to locate machines with the appropriate dll and mof files and copy them to the local corresponding directories. Enjoy your new WMI build!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s