Thursday, 13 October 2011

How to troubleshoot the systems which has WMI issues ? (Rebuild WMI Repository)

Had several systems which had wmi issue in doing client /application installation.This is most common issue which we face if something happens to the system.To get solved,use the script which can be run remotely using psexec tool. http://blogs.technet.com/b/configmgrteam/archive/2009/05/08/wmi-troubleshooting-tips.aspx
Note : The below script tested only on Windows XP ,not tested on higher versions like Windows 7
Download the psexec tool from Microsoft .Here are the basic instruction in doing it.
1.copy the psexec.exe tool on to new folder (G:\script) and create 3 new files(wmifix.bat,computers.txt and run.bat).Each file script has given below.
wmifix:
@echo off
REM  WMI Repair
Title WMI Repair script running on the client machines
%windir%\system32\wbem\winmgmt /clearadap
%windir%\system32\wbem\winmgmt /kill
%windir%\system32\wbem\winmgmt /unregserver
%windir%\system32\wbem\winmgmt /regserver
%windir%\system32\wbem\winmgmt /resyncperf
net stop winmgmt /y
REM if exist %windir%\system32\wbem\repository.old rmdir /s /q %windir%\system32\wbem\repository.old
REM ren %windir%\system32\wbem\repository repository.old
regsvr32 /s %systemroot%\system32\scecli.dll
regsvr32 /s %systemroot%\system32\userenv.dll
for /f %%s in (‘dir /b /s %windir%\system32\wbem\*.dll’) do regsvr32 /s %%s
for /f %%s in (‘dir /b /s %windir%\system32\wbem\*.mof’) do mofcomp %%s
for /f %%s in (‘dir /b %windir%\system32\wbem\*.mfl’) do mofcomp %%s
net start winmgmt
%windir%\system32\wbem\wmiprvse /regserver






run.bat
@echo off
cd G:\script
G:
psexec @computers.txt -c G:\script\wmifix.bat
computers.txt
Add list of computers to the txt file which you have trouble.
Use the above script to fix wmi issues on computers,if that doesnt repair,remove the bold letters REM and try.this will delete the repository and recreates it for you to work wmi correctly.
more information about troubleshooting can be found from http://blogs.technet.com/configmgrteam/archive/2009/05/08/wmi-troubleshooting-tips.aspx









No comments:

Post a Comment