您的当前位置:首页正文

安装sqlserver出现wmi无法启动

2020-11-09 来源:汇智旅游网

WmiServiceStateCheck 检查 WMI 服务是否已在计算机上启动并正在运行。 失败 无法启动 Windows Management Instrumentation (WMI)服务。若要继续安装,必须找到问题并修复 Windows Management Instrumentation (WMI)服务。 错误如上 可以正常停止和启动、包

WmiServiceStateCheck 检查 WMI 服务是否已在计算机上启动并正在运行。 失败 无法启动 Windows Management Instrumentation (WMI)服务。若要继续安装,必须找到问题并修复 Windows Management Instrumentation (WMI)服务。

错误如上

可以正常停止和启动、包括重新启动 都是正常的 重置

google了下

第一种办法:

执行下边的脚本无用:

@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

没有报错

第二种办法:用这里的办法也没用

http://social.technet.microsoft.com/Forums/en-US/itprovistasetup/thread/11d6d64e-543b-40cd-a0f6-ba97c3806fbb/

1) Start the computer and press F8 on boot up and select Safe Mode.
2) In the start menu type "cmd" (without quotes) and on the top search result, right click the program icon and choose Run as administrator
3) Type "net stop winmgmt" (without quotes) and press Enter to make certain the WindowsManagementInstrumentation (WMI) service is not running.
4) Open a Windows Explorer and locate the path to C:\ windows\system32\WBEM\ folder and rename the Repository folder to something else like RepositoryOLD (right click and choose 'Rename Folder').
5) Reboot and restart as normal.
6) In the start menu type "cmd" (without quotes) and on the top search result, right click the icon and choose Run as administrator
7) Type "net stop winmgmt" (without quotes) and press enter to stop the WMI service.
8) Type "winmgmt /resetRepository" (without quotes) and restart the computer.

每一步都提示成功的 最后一步是 重置成功 然后重启计算机 运行sql安装程序还是这个错误

第三种办法:
参考:https://connect.microsoft.com/SQLServer/feedback/details/682543/wmi-service-cannot-be-started-when-installing-sql-server-denali-ctp3

SELECT NAME FROM WIN32_SERVICE WHERE NAME = 'winmgmt'

Win32_Service.Name='winmgmt'

跟这位的错误时一样的 包括 运行powershell

PS C:\Windows\System32\wbem> get-wmiobject -Query "SELECT NAME FROM WIN32_SERVICE WHERE NAME = 'winmgmt'"
Get-WmiObject : 未将对象引用设置到对象的实例。
所在位置 行:1 字符: 14
+ get-wmiobject <<<< -Query "SELECT NAME FROM WIN32_SERVICE WHERE NAME = 'winmgmt'"
+ CategoryInfo : NotSpecified: (:) [Get-WmiObject], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

我运代码 2.0 3.5 4.0 都是正确的下边的代码:

using System;
using System.Management;

public class Sample
{
public static void Main()
{
ManagementClass c = new ManagementClass("Win32_Process");
foreach (ManagementObject o in c.GetInstances())
Console.WriteLine(
"Next instance of Win32_Process : {0}", o["Name"]);

Console.ReadKey();

}
}

输出没有异常

-------------看那位后边似乎是重装系统搞定的

高手给看看看

显示全文