WMI 命名空间 root\cimv2 在 Win2k 上不可用?
我试图在 Win2k SP4 上运行以下 VBScript 代码:
strComputer = "."
Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
它在 XP 和 Win7 上运行没有问题,但在这个 2k 机器上我收到以下错误:
C:\test_wmi.vbs(3, 1) (null): 0x8004100E
错误描述是:找不到指定的命名空间。
当我使用以下代码查询根上的命名空间时:
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root")
Set colNameSpaces = objSwbemServices.InstancesOf("__NAMESPACE")
For Each objNameSpace In colNameSpaces
Wscript.Echo objNameSpace.Name
Next
我得到:
DEFAULT
SECURITY
WMI
directory
aspnet
据我所知,CIMV2 命名空间应该在那里。有什么想法吗???
谢谢!
约奇。
I'm trying to run the following VBScript code on a Win2k SP4:
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:
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:
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???
Thanks!
yorch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用的是 Windows Server 2003 Service Pack 2,yorch 的解决方案对我不起作用。最后我找到了这个页面,并按照 Server 2003 的说明进行操作:
http://www.djordjepejic.com/kb68/index.php/article/winmgmt-could-not-initialize-the-core-parts-solved-even/
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:
http://www.djordjepejic.com/kb68/index.php/article/winmgmt-could-not-initialize-the-core-parts-solved-even/
是的,它应该在那里。有一个名为 wmidiag.vbs 可以帮助您诊断 WMI 问题,但在使用它之前,请尝试观看一些解释如何使用它的“网络广播”(此处 和此处)
Yes, it should be there. There is a tool called wmidiag.vbs that can help you diagnose WMI problems, but before using it try watching a couple of 'webcasts' that explain how to use it (here and here)
最后,对我有用的是重建 WMI 存储库。这就是我所做的:
此外,此方法可能会有所帮助(将 WMI 重新安装到注册表中):
感谢 Uros 的帮助,网络广播和该工具都非常有帮助。
Finally, what worked for me was rebuilding the WMI Repository. This is what I did:
Also, this method could have helped (to reinstall WMI into the Registry):
Thanks Uros for your help, both webcasts and the tool were very helpful.