WMI : repair, find KB, log

repaire WMI

1.Stopper le service WMI par la commande net stop winmgmt

2.Supprimer le dossier WMI repository : RD %systemroot%system32wbemRepository /S /Q

3.Puis redémarrer le service WMI, ce qui aura pour effet de recréer le dossier Repository : net start winmgmt

 

winmgmt /verifyrepository – checks the WMI repository for consistency

Winmgmt /resetrepository – resets the WMI repository back to its initial state after the OS was first installed

 

 

cd /d %windir%\system32\wbem

for %i in (*.dll) do RegSvr32 -s %i

for %i in (*.exe) do %i /RegServer

wbemtest

 

 

net stop winmgmt /?

winmgmt /clearadap

winmgmt /kill

winmgmt /unregserver

winmgmt /regserver

winmgmt /resyncperf

regsvr32 c:\windows\system32\wbem\wmiutils.dll

 

  1. Arrêter le service « Infrastructure de gestion Windows »
  2. Supprimez tous les fichiers qui se trouvent dans le dossier c:\Windows\System32\Wbem\Repository
  3. ré enregsitrer les DLL « for %i in (*.dll) do RegSvr32 -s %i »
  4. Redémarrez votre ordinateur

sfc /scannow

https://blogs.technet.microsoft.com/askperf/2009/04/13/wmi-rebuilding-the-wmi-repository/https://blogs.technet.microsoft.com/askperf/2009/04/13/wmi-rebuilding-the-wmi-repository/

  1. Re-register all dlls, recompile the .mofs in the wbem folder and re-registering WMI Service and Provider. You can use the following script by saving to txt file then renaming to .bat and running from command prompt with admin right and changing focus to following directory: C:\Windows\System32\Wbem.

 

@echo off

sc config winmgmt start= disabled

net stop winmgmt /y

%systemdrive%

cd %windir%\system32\wbem

for /f %%s in (‘dir /b *.dll’) do regsvr32 /s %%s

wmiprvse /regserver

winmgmt /regserver

sc config winmgmt start= auto

net start winmgmt

for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s

 

  1. Reboot the machine and test WMI

 

 

#### LOG ####

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WBEM\CIMOM\Logging = 2

The following list lists the logging levels that can be defined in the registry.

 

Logging level :

0 No Logging

1 Log only errors

2 Verbose Logging (default)

https://msdn.microsoft.com/en-us/library/aa392285(v=vs.85).aspx


Trouver hotfix / kb

wmic qfe get hotfixid | find « 981314 »

 

En PowerShell

get-hotfix -id 981314

 

wmic qfe get hotfixid | find « KB99999 »
wmic qfe | find « KB99999 »

 

https://serverfault.com/questions/263847/how-can-i-query-my-system-via-command-line-to-see-if-a-kb-patch-is-installed

One thought on “WMI : repair, find KB, log”

Laisser un commentaire