WMI 命名空间 root\cimv2 在 Win2k 上不可用?

发布于 2024-09-18 10:09:41 字数 787 浏览 7 评论 0原文

我试图在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

执笔绘流年 2024-09-25 10:09:41

我使用的是 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/

对于 Windows Server 2003
使用以下命令检测并修复损坏的 WMI 存储库:

rundll32 wbemupgd,RepairWMISetup

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/

For Windows Server 2003
Use the following command to detect and repair a corrupted WMI Repository:

rundll32 wbemupgd, RepairWMISetup

鸠书 2024-09-25 10:09:41

是的,它应该在那里。有一个名为 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)

一杯敬自由 2024-09-25 10:09:41

最后,对我有用的是重建 WMI 存储库。这就是我所做的:

  • 停止 WMI 服务 (net stop winmgmt)
  • 转到 %windows%/system32/wbem (在我的 win2k 中,winnt,在 XP 上是 windows)
  • 重命名或删除存储库目录
  • 再次启动 WMI 服务 (net启动 winmgmt)

此外,此方法可能会有所帮助(将 WMI 重新安装到注册表中):

winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf

感谢 Uros 的帮助,网络广播和该工具都非常有帮助。

Finally, what worked for me was rebuilding the WMI Repository. This is what I did:

  • 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)

Also, this method could have helped (to reinstall WMI into the Registry):

winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf

Thanks Uros for your help, both webcasts and the tool were very helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文