首頁  >  文章  >  資料庫  >  安装sqlserver出现wmi无法启动

安装sqlserver出现wmi无法启动

WBOY
WBOY原創
2016-06-07 15:39:482568瀏覽

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

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

 错误如上

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

 

 

google了下

第一种办法:

执行下边的脚本无用:

@echo on <br>cd /d c:\temp <br><span>if</span> not exist %windir%\system32\wbem <span>goto</span> TryInstall <br>cd /d %windir%\system32\wbem <br>net stop winmgmt <br>winmgmt /kill <br><span>if</span> exist Rep_bak rd Rep_bak /s /q <br>rename Repository Rep_bak <br><span>for</span> %%i <span>in</span> (*.dll) <span>do</span> RegSvr32 -s %%i <br><span>for</span> %%i <span>in</span> (*.exe) <span>do</span> call :FixSrv %%i <br><span>for</span> %%i <span>in</span> (*.mof,*.mfl) <span>do</span> Mofcomp %%i <br>net start winmgmt <br><span>goto</span> End <br><br>:FixSrv <br><span>if</span> /I (%<span>1</span>) == (wbemcntl.exe) <span>goto</span> SkipSrv <br><span>if</span> /I (%<span>1</span>) == (wbemtest.exe) <span>goto</span> SkipSrv <br><span>if</span> /I (%<span>1</span>) == (mofcomp.exe) <span>goto</span> SkipSrv <br>%<span>1</span> /RegServer <br><br>:SkipSrv <br><span>goto</span> End <br><br>:TryInstall <br><span>if</span> not exist wmicore.exe <span>goto</span> End <br>wmicore /s <br>net start winmgmt <br>:End

没有报错

 

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

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

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

<br><br>

每一步都提示成功的 最后一步是 重置成功  然后重启计算机  运行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=<span data-mce-="">'</span><span data-mce-="">winmgmt</span><span data-mce-="">'</span>

 

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

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

<br><br>

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

using System;
using System.Management;<br><br>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"]);<br><br> Console.ReadKey();<br><br> }
}
<br><br>

输出没有异常

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

 

 

高手给看看看

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn