locked
How to detect WMI corruption RRS feed

  • Question

  • Hi,

    what is the easiest way to detect WMI corruption without using any diagnostic tool

    is it possible to detect it by checking the existence of some reg keys? or age of file?

    what I'm trying to achieve is, I have a script to reset/repair WMI run manually

    I need the script to run automatically when WMI is corrupted

    We have a software that can trigger some action if something happen (such as reg key change, or if a file haven't been update for a while etc...)

    can anyone advise?

    thanks

    Andy

    Monday, April 23, 2012 11:55 AM

All replies

  • Hi,

    here is a script if wmi is corrupted.

    @echo on
    cd /d c:\temp
    if not exist %windir%\system32\wbem goto TryInstall
    cd /d %windir%\system32\wbem
    net stop winmgmt
    winmgmt /kill
    if exist Rep_bak rd Rep_bak /s /q
    rename Repository Rep_bak
    for %%i in (*.dll) do RegSvr32 -s %%i
    for %%i in (*.exe) do call :FixSrv %%i
    for %%i in (*.mof,*.mfl) do Mofcomp %%i
    net start winmgmt
    goto End

    :FixSrv
    if /I (%1) == (wbemcntl.exe) goto SkipSrv
    if /I (%1) == (wbemtest.exe) goto SkipSrv
    if /I (%1) == (mofcomp.exe) goto SkipSrv
    %1 /RegServer

    :SkipSrv
    goto End

    :TryInstall
    if not exist wmicore.exe goto End
    wmicore /s
    net start winmgmt
    :End

    Regards,

    Tim


    http://directoryadmin.blogspot.com

    Monday, April 23, 2012 12:23 PM
  • thanks for your prompt reply

    can you explain to me how this script works?

    thanks

    andy


    edit: i'm more interested on how to detect the corruption
    • Edited by bostos Monday, April 23, 2012 1:06 PM
    Monday, April 23, 2012 12:38 PM