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

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

  1. Thanks for your swift reponse. This report is for SCCM 2012 environment but we are using 2007 currently. Do you have similar kind of report for SCCM 2007 version.

    Reply
    1. you will have to install client health status reporting tool to get such information.By default,there is no such info you get from CM07 and only possible things is to get,how many clients active,inactive,obsolete etc.

      Reply
  2. Do you have any script or sccm report which can tell me which clients are healthy, which are not healthy with the reason and which clients have WMI issues.

    We are facing issues on many machines where RAP is blank. Just want to automate things.

    Reply
  3. Hi Eswar,

    I have tried using this script and the result shows as below: Does this mean the Script ran successfully and WMI repair was done or not, kindly suggest.

    The following services are dependent on the Windows Management Instrumentation s
    ervice.
    Stopping the Windows Management Instrumentation service will also stop these ser
    vices.

    Intel(R) Rapid Storage Technology
    Dell ControlPoint System Manager
    Dell ControlPoint Button Service

    The Intel(R) Rapid Storage Technology service is stopping..
    The Intel(R) Rapid Storage Technology service was stopped successfully.

    The Dell ControlPoint System Manager service is stopping.
    The Dell ControlPoint System Manager service was stopped successfully.

    The Dell ControlPoint Button Service service is stopping.
    The Dell ControlPoint Button Service service was stopped successfully.

    The Windows Management Instrumentation service is stopping.
    The Windows Management Instrumentation service was stopped successfully.

    The system cannot find the file ædir.
    The system cannot find the file ædir.
    The system cannot find the file ædir.
    The requested service has already been started.

    More help is available by typing NET HELPMSG 2182.
    wmifix.bat exited on \\Machine Name with error code 0.

    Regards,
    Mikey

    Reply
  4. Hi Ismail,
    Please do check your DP and MP and also check if machine's polocy is working fine.
    I dealt the same type of issue in my environment and there was a issue with DP.

    Reply
  5. hi eswar,
    i have distribute one package to 2 test pc. the package is working fine in one pc.i have tried to open the app in another test pc.. it will loading and disappeared. i do not know y dis was happened. and also i have tried to repair the app in ARP. it throws an error msg "Fatal error during installation".

    could u plz send reply ASAP?

    Reply
  6. Hey koneti,
    how can I add a "safe sender" entry via script or is there a
    command line I can use to do it? I am looking for something
    sprcifically unrelated to the UI entry method, something scriptable
    that I can wrap and deploy to remote workstations in my enterprise.

    Reply
  7. hi eswar,

    Hope you are doing gud.. I want to Create a script to configure settings in Internet Explorer.

    The option “Automatically detect settings” should be blank (not selected) for all users and for the default user.
    is this possible to create VB Script for that?
    can i have any links ?

    Reply
  8. Hi eswar.
    I am working on SMS environment. We have some of the clients hasn't reporting to sms server for last 30 days.i found the error is SMS agent issue. Is there any Script for repair the sms agent service?. and one more thing is that when i am trying to ping the machines with ipaddress ,its resolving another machine.

    If u have any script for repair sms agent in Sms client,provide me ASAP.

    thanks ,
    Ismail

    Reply
    1. Hi Syed,
      How do you say issues with SMS agent ? and for Ip address conflits,you have DNS issue .Please do scavenging on DNS server .BEfore that verify if single IP address is assiged to multiple computers (you should see many entries in DNS) as i saw this many times in my environment.

      Reply

Leave a Reply