Query "SELECT * from Win32_Process" hangs indefinitely

As a part of a larger C# code base, I've been running the following query regularly on the same machine (Windows XP SP2):

"SELECT * from Win32_Process"

It's been working as expected until today. Now, the query hangs indefinitely without returning any results. I've tried querying several other WMI Provider classes on this machine, and they work as expected.

I rebooted the machine, but that didn't help. I checked the Application event log, where WMI reports errors, but there are no clues there. I've also tried two other methods of enumerating the Win32_Process instances : a VBscript, and WMI CIM Studio. Both hang in the same way.

I tried running WMIDiag.vbs, a diagnostic script provided by Microsoft. However, it hangs indefinitely during the step called "Verifying WMI Providers loaded BEFORE WMIDiag execution." The documentation does say the script can take up to 6 hours to run, but it's been hung at 0% CPU usage for more than 12 hours now.

I'm at a loss here. Can anybody suggest why a single the Win32_Process class might cease working, while the rest of the WMI classes are behaving as usual? I would strongly prefer to fix this issue specifically, rather than throwing up my hands and wiping the machine.

If there is any extra system information that would be useful, please let me know. I don't have a clue where to proceed next with the troubleshooting process.


WMI might have gotten corrupt on that machine. Try reinstalling it.

COPY ALL LINES BELOW INTO A BATCH FILE AND RUN IT:

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