WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WMI
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Error 1261 on ConnectServer line

 Keywords:  WMI 1261 Locator.ConnectServer

Question:

Trying the following WMI solution, to grab a list ofremote processes, I got an error 1261 on the line:
Service = Locator.ConnectServer(computername,"root/cimv2",username,password)
The parameters seems to be OK, what is the meaning of root/cimv2, is it particular to your machine or generic to all machines ?

Answer:

My guess is the problem has to do with connecting to the remote machine. Check the wwwbatch.ini for details about that error. See the heading:
[OLE Exception]
...post what you see there...
And yes root/cimv2 is common to all machines.

User Reply #1:

Here is what I get in Ole exception section (in french):
SWbemLocator=Classe non enregistrée
In English, something like : not registered class

I am runnning the script on a Windows XP machine.

Tech Reply #1:

Ummm. Seems like WMI not installed on your system. However WMI is installed by default on Windows XP.

WMI System Requirements
The WMI operating system core components are supported on Windows NT 4.0 with Service Pack 4 or later, including Windows 2000/XP, and on Windows 95 OSR2 and Windows 98.

The WMI infrastructure consists of the following components:

- The actual WMI software (Winmgmt.exe), a component that provides applications with uniform access to management data.

- The Common Information Model (CIM) repository, a central storage area for management data.

Where do I get WMI?
For Win95, 98, and NT 4.0, if WMI is not already installed, you can download the Windows Management Instrumentation (WMI) CORE 1.5 from Microsoft at: http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/576/msdncompositedoc.xml&frame=true

Here are a few things to try:

- First check that the Windows Management Instrumentation service is running, in under 'Services'.

- Try stopping WMI service and rebooted the machine.

User Reply #2:

I found nothing running with the name winmgmt.exe on my machine, I found a service named winmgmt. I stopped and restarted that service, and nothing happens.

Tech Reply #2:

Have you tried rebooting this machine?

I would suggest running WMI Tester on this machine.

WMI Tester (wbemtest.exe) is a general-purpose, graphical tool for interacting with the WMI infrastructure. You can use WMI Tester to browse the CIM schema and examine managed resource class definitions. WMI Tester can also be used to perform the same actions your WMI-based scripts perform, such as retrieving instances of managed resources and running queries. Because WMI Tester is part of the default WMI installation on all WMI-enabled computers, wbemtest.exe is an excellent WMI learning and troubleshooting tool. For information about using WMI Tester, see the WMI Tester overview in Windows XP Help and Support Center.

Open a command prompt, type C:\>wbemtest.exe , and press Enter to start the WMI Tester tool. Notice most of the buttons are disabled on the main WMI Tester window, which means that you haven't connected to WMI at this point.

Click Connect… to connect to the WMI service on a local or remote computer. The Connect dialog is displayed, which provides a text entry field labeled Namespace that contains root\default as its default value. Change the Namespace field's value to root\cimv2 and click the Connect dialog's Connect button to return to the main WMI Tester window.

The Namespace identifier in the main window's upper-left hand corner should read root\cimv2. Notice all of the buttons are now enabled, which indicates that you have successfully connected to WMI on the local host under the context of your current credentials.

Click Enum Classes… to open the Superclass Info dialog. In the Superclass Info dialog, leave the Enter superclass name field blank, click the Recursive option, and click OK to enumerate all CIM classes defined in the root\cimv2 namespace.

At this point, you should be looking at a Query Result dialog that lists hundreds of class definitions. The number of classes largely depends on the version of Windows you're running. If you're using Windows 2000, for example, you should see somewhere in the neighborhood of 600 class definitions. If you're running Windows XP, you should see approximately 900.

Notice that the classes listed at the top of the Query Result dialog are prefaced with two underscores. These are system classes. System classes are predefined CIM classes that support internal WMI configuration and operations, such as provider registration, namespace security, and event notification. For now, ignore the system classes and scroll down the Query Result dialog until you get to classes that begin with CIM_.

Classes whose names begin with CIM_ are the core and common base classes maintained by the DMTF. Continue scrolling until you reach the classes that begin with Win32_.

Classes whose names begin with Win32_ are Microsoft extension classes, which represent Windows-specific managed resources. If this is the first time you've examined the root\cimv2 namespace, you might want to become familiar with the comprehensive set of classes in the root\cimv2 namespace, especially the classes that have a Win32_ prefix.

Scroll down the Query Result dialog until you reach the Win32_Process class, and double-click the class name to open the Object editor for Win32_Process dialog.

Note I find it kindof strange you cannot locate winmgmt.exe on this system.

It seems to be a problem with this particular XP machine. For some reason the WMI component object doesn't seem to be registered.

Let me know the results running WMI Tester ....

MORE...
The Windows Management service is the operating system component that contains the WMI repository. On computers running Windows 98, the Windows Management service runs as a standard executable file (Winmgmt.exe). On computers running Windows NT/Windows 2000, the Windows Management service runs as a separate service process. On computers running Windows XP, the Windows Management service is implemented as a service process within SVCHOST. In all cases, the Windows Management service automatically starts when the first management application makes a call to connect.

http://msdn.microsoft.com/library/en-us/wmisdk/wmi/winmgmt.asp?frame=true

User Reply #3:

Thanks a lot for all these explanations. It works fine now. I now, get only the "not registred class" when trying to access remote machine not running WMI.
Article ID:   W15356
File Created: 2004:07:15:08:16:22
Last Updated: 2004:07:15:08:16:22