WMI namespace root\cimv2 not available on Win2k?

0

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.

windows
vbscript
wmi
windows-2000
asked on Stack Overflow Sep 9, 2010 by yorch

3 Answers

2

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

answered on Stack Overflow Jul 8, 2013 by Adam Nofsinger
1

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)

answered on Stack Overflow Sep 9, 2010 by (unknown user)
1

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.

answered on Stack Overflow Sep 10, 2010 by yorch

User contributions licensed under CC BY-SA 3.0