Restore HP Namespace in WMI

I am trying to restore the HP Namespace in WMI. Since I do not know the specific MOF file(s) involved, I am using a hammer to recompile all MOFs and register all dlls in c:\windows\system32\wbem. This script works when I run it manually line-by-line from an administrative command prompt, but running via a Bigfix fixlet does not work.

delete wmifix.bat
delete __createfile
createfile until end
@ECHO OFF
sc config winmgmt start= disabled
net stop winmgmt /y
timeout /T 10
%systemdrive%
cd %windir%\system32\wbem
for /f %%s in ('dir /b *.dll') do regsvr32 /s %%s
wmiprvse /regserver
sc config winmgmt start= auto
net start winmgmt
for /f %%s in ('dir /s /b *.mof *.mfl') do mofcomp %%s
end
move __createfile wmifix.bat 
waithidden wmifix.bat

I would use the 2>&1 output redirection to get a better understanding of what is happening.

For example:

delete wmifix.bat
delete __createfile
delete wmifix.log
createfile until end
sc config winmgmt start= disabled > wmifix.log 2>&1
net stop winmgmt /y >> wmifix.log 2>&1
timeout /T 10 >> wmifix.log 2>&1
%systemdrive% >> wmifix.log 2>&1
cd %windir%\system32\wbem >> wmifix.log 2>&1
for /f %%s in (‘dir /b *.dll’) do regsvr32 /s %%s >> wmifix.log 2>&1
wmiprvse /regserver >> wmifix.log 2>&1
sc config winmgmt start= auto >> wmifix.log 2>&1
net start winmgmt >> wmifix.log 2>&1
for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s >> wmifix.log 2>&1
end
move __createfile wmifix.bat

32-bit redirection.

Add an
action uses wow64 redirection false
anywhere before the ‘waithidden’ command.

As it stands now, it’s running the 32-bit version of cmd.exe so the calls for \windows\system32 would be redirected to \windows\syswow64, and you’ll only re-register the 32-bit MOFs (if there are any)

1 Like

Thanks Jason! You saved the day again.

1 Like

Glad to help!
(Forum padding)