Windows Management Instrumentation 服务卸载并重新创建

时间:2022-05-31 00:44:12
SC delete Winmgmt
sc create Winmgmt binPath= "C:\Windows\System32\svchost.exe -k netsvcs" type= share start= auto DisplayName= "Windows Management Instrumentation" group= netsvcs depend= RpcSs
sc description Winmgmt "提供共同的界面和对象模式以便访问有关操作系统、设备、应用程序和服务的管理信息。如果此服务被终止,多数基于 Windows 的软件将无法正常运行。如果此服务被禁用,任何依赖它的服务将无法启动。"

服务出现问题,启动不了,出现“error2,指定文件找不到” ,解决办法如下,在wbem目录下执行命令行:

for %i in (*.dll) do RegSvr32 -s %i
Regsvr32 -s scrcons.exe
Regsvr32 -s unsecapp.exe
Regsvr32 -s wbemtest.exe
Regsvr32 -s WinMgmt.exe
Regsvr32 -s WmiApSrv.exe
Regsvr32 -s WmiPrvSE.exe

再次启动wmi服务时,提示服务已经启动,OK,完成重装WMI服务。微软官网解决说明

其它问题处理办法:

关于WMI服务日志报错导致服务停掉的BUG修改批处理脚本如下,保存为VBS脚本文件:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\subscription") Set obj1 = objWMIService.Get("__EventFilter.Name='BVTFilter'")
set obj2set = obj1.Associators_("__FilterToConsumerBinding")
set obj3set = obj1.References_("__FilterToConsumerBinding") For each obj2 in obj2set
WScript.echo "Deleting the object"
WScript.echo obj2.GetObjectText_
obj2.Delete_
next
For each obj3 in obj3set
WScript.echo "Deleting the object"
WScript.echo obj3.GetObjectText_
obj3.Delete_
next
WScript.echo "Deleting the object"
WScript.echo obj1.GetObjectText_
obj1.Delete_

保存为Workaround.vbs
右键命令提示“command prompt”
单击开始,程序,右键命令行,以管理员运行,执行vbs

其它解决方法:

sfc /scannow

遇到服务无法启动的情况,解决方法

rem open a CMD window (in Win7/Vista open as admin) and type at the cmd prompt:
net stop winmgmt rem(choose Y when needed)
winmgmt /resetrepository
net start winmgmt
@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
sc stop SharedAccess
sc stop iphlpsvc
sc stop wscsvc

参考:https://blog.csdn.net/haiross/article/details/12950175

https://www.cnblogs.com/Full--Stack/p/8041397.html

https://support.microsoft.com/en-us/help/2545227/event-id-10-is-logged-in-the-application-log-after-you-install-service

https://answers.microsoft.com/en-us/windows/forum/all/wmi/fd22fec4-f5c9-4d83-9373-e7d8063d3e8b

https://social.technet.microsoft.com/Forums/windows/en-US/b3414a97-3eca-4d18-a755-3c36635ccb71/windows-vista-processor-info-shows-quotnot-availablequot-wmi-not-working?forum=itprovistasetup