windows WMI 命名空间 root\cimv2 在 Win2k 上不可用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3678390/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WMI namespace root\cimv2 not available on Win2k?
提问by yorch
I'm trying to run the following VBScript code on a Win2k SP4:
我正在尝试在 Win2k SP4 上运行以下 VBScript 代码:
strComputer = "."
Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")
It works on XP and Win7 without problems, but on this 2k box I get the following error:
它在 XP 和 Win7 上运行没有问题,但在这个 2k 的机器上我收到以下错误:
C:\test_wmi.vbs(3, 1) (null): 0x8004100E
The error description is: Namespace specified cannot be found.
错误描述是:找不到指定的命名空间。
When I query the namespaces on root, using this code:
当我在 root 上查询命名空间时,使用以下代码:
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\" & strComputer & "\root")
Set colNameSpaces = objSwbemServices.InstancesOf("__NAMESPACE")
For Each objNameSpace In colNameSpaces
Wscript.Echo objNameSpace.Name
Next
I get this:
我明白了:
DEFAULT
SECURITY
WMI
directory
aspnet
As far as I have read, CIMV2 namespace should be there. Any ideas???
据我所知,CIMV2 命名空间应该在那里。有任何想法吗???
Thanks!
谢谢!
yorch.
约克。
回答by Adam Nofsinger
I was on Windows Server 2003, Service Pack 2, and yorch's solution didn't work for me. Finally I found this page, and followed the instructions for Server 2003:
我使用的是 Windows Server 2003 Service Pack 2,而 yorch 的解决方案对我不起作用。最后我找到了这个页面,并按照 Server 2003 的说明进行操作:
For Windows Server 2003 Use the following command to detect and repair a corrupted WMI Repository:
rundll32 wbemupgd, RepairWMISetup
对于 Windows Server 2003 使用以下命令检测和修复损坏的 WMI 存储库:
rundll32 wbemupgd, RepairWMISetup
回答by Adam Nofsinger
Yes, it should be there. There is a tool called wmidiag.vbsthat can help you diagnose WMI problems, but before using it try watching a couple of 'webcasts' that explain how to use it (hereand here)
是的,它应该在那里。有一个名为wmidiag.vbs的工具可以帮助您诊断 WMI 问题,但在使用它之前,请尝试观看一些解释如何使用它的“网络广播”(此处和此处)
回答by yorch
Finally, what worked for me was rebuilding the WMI Repository. This is what I did:
最后,对我有用的是重建 WMI 存储库。这就是我所做的:
- Stop the WMI service (net stop winmgmt)
- Go to %windows%/system32/wbem (in my win2k, winnt, on XP would be windows)
- Rename or remove the repository directory
- Start the WMI service again (net start winmgmt)
- 停止 WMI 服务(net stop winmgmt)
- 转到 %windows%/system32/wbem(在我的 win2k 中,winnt,在 XP 上是 windows)
- 重命名或删除存储库目录
- 再次启动WMI服务(net start winmgmt)
Also, this method could have helped (to reinstall WMI into the Registry):
此外,此方法可能有所帮助(将 WMI 重新安装到注册表中):
winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf
Thanks Uros for your help, both webcasts and the tool were very helpful.
感谢 Uros 的帮助,网络广播和工具都非常有帮助。