WMI Fix Batch file to run on multiple systems

@echo off
%windir%\system32\wbem\winmgmt /clearadap
%windir%\system32\wbem\winmgmt /kill
%windir%\system32\wbem\winmgmt /unregserver
%windir%\system32\wbem\winmgmt /reserver
%windir%\system32\wbem\winmgmt /resyncperf
net stop winmgmt /y
if exist %windir%\system32\wbem\repository.old rmdir /s /q %windir%\system32\wbem\repository.old
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

Save above batch file as wmifix.bat and run with the PSexec.exe with below command line

 

psexec @list.txt -c c:\scripts\wmifix.cmd

List.txt


Add list of computers to the list.txt file which you have trouble.

0 comments:

Post a Comment