WMI check is pretty simple – it just makes sure root\cimv2 can be connected to. WMI fix will stop WMI and dependent services, re-register all DLL, EXE, MOF and MFL files in correct paths (x86 and x64 supported) and then start the services again. The robust method of repository renaming/removal is NOT used here.

When running the WMI fix action on remote computers, the tool first creates a fixing batch file “%TEMP%\fixwmi.bat” on administrator’s computer. This batch file is then copied to each remote computer (in “%windir%\temp\” folder) and the execution of the script is scheduled to run after 1 minute. All batch file output is written to “%windir%\temp\fixwmi.log” file on each remote computer.

Unfortunately, in order to fix the WMI, the SCCM CAT still requires that WMI core is somewhat working. The tool queries for OS specific information from each client (to determine architecture and OS version) and it uses Win32_Process class to schedule the execution of WMI fixing script remotely. If WMI service is not working at all, SCCM CAT can’t help here and issue must be solved locally.

Here’s the full source of FixWMI.bat that is executed on client computers:

net stop winmgmt
PUSHD "%windir%\system32\wbem"
for %%i in (*.dll) do regsvr32 -s %%i
mofcomp.exe /RegServer
scrcons.exe /RegServer
unsecapp.exe /RegServer
winmgmt.exe /RegServer
wmiadap.exe /RegServer
wmiapsrv.exe /RegServer
wmiprvse.exe /RegServer

IF EXIST "%windir%\SysWOW64\wbem" (
GOTO OS_64
) ELSE (
GOTO Gate1
)

:OS_64
PUSHD "%windir%\SysWOW64\wbem"
for %%i in (*.dll) do regsvr32 -s %%i
mofcomp.exe /RegServer
scrcons.exe /RegServer
unsecapp.exe /RegServer
winmgmt.exe /RegServer
wmiadap.exe /RegServer
wmiapsrv.exe /RegServer
wmiprvse.exe /RegServer
POPD

:Gate1
ver | find "XP" > nul
IF NOT %ERRORLEVEL% == 1 (
GOTO ver_xp
) ELSE (
GOTO ver_7
)

:ver_xp
for %%i in (*.mof) do mofcomp %%i
for %%i in (*.mfl) do mofcomp %%i
GOTO End

:ver_7
"%windir%\system32\wbem\winmgmt.exe" /resetrepository
GOTO End

:End
net start ccmexec
net start winmgmt
POPD
DEL /F /Q "%windir%\temp\fixwmi.bat"
EXIT

Last edited Feb 28, 2012 at 7:30 AM by pr3m, version 5

Comments

No comments yet.