Implementation of Windows Automation management (3)

Source: Internet
Author: User
Tags log requires win32 window
Window

The WMI Software Development Kit (SDK) makes it easy to view the available CIM and WIN32 classes. WMI SDK can be from http://msdn.microsoft.com/downloads/default.asp? Url=/code/sample.asp?url=/msdn-files/027/001/566/msdncompositedoc.xml download, there are more than 8M, is not small.

The WMI SDK requires that the operating system be Windows 2K/XP or NT 4.0 SP4 or later, although WMI support software can be installed on the Win9x system, but the SDK cannot be run on Win9x. In addition, for ActiveX controls that support the SDK, the SDK also requires IE 5.0 or later. The minimum machine performance requirements for the SDK are: Pentium processor, MB ram,40 MB disk space, and at least 600, 256-color display devices. These requirements should not be a problem for machines running Windows 2K/XP. CIMOM is run as a service by default, but if the machine does not have a network card, CIMOM cannot run as a service, but it can be run as an application, just perform winmgmt.exe. Winmgmt.exe is in the \%systemroot%\system32\wbem WMI home directory.

The SDK must be installed by a member of the Administrators group. The installation process is simple, perform the WMISdk.exe Startup Wizard, and specify the target directory for the installation (default is \program Files\wmi). Select the optional components to install (all components except SNMP support are installed by default), and then click Finish. The installation SDK does not require a reboot. When the installation is complete, a WMI SDK group is added to the Start/program menu.

Click WMI CIM Studio for the WMI SDK program group. CIM Studio prompts for the connection namespace and shows that the default connection's namespace is root\cimv2 and confirms it. If you log on to Windows as an administrator, click OK again to log in as your current identity, and if you log on to Windows with a different identity, log in with the administrator instead.

Now, let's say we're looking for an object on the current machine: C: drive. We don't know the specific name of the C: drive in CIM or WMI, and browsing through the hundreds of classes listed in CIM Studio is too troublesome. You can use the Find button (the telescope at the top left, see figure III). Figure II shows the Search for Class dialog box displayed after clicking the Find button, where you enter the word that should be included in the class name of the C: drive, and then click the Go! button. Since we are looking for a named partition, and we know that Windows calls this partition logical disk or logical drive, the search keyword here can be logical. Of course, search keywords can also be disk, but there will be a lot of search results appear.



Figure II

Figure II shows the results of the search keyword logical. Select Win32_LogicalDisk and click OK, Tu San window appears (why not choose CIM_LogicalDisk?) As mentioned earlier, all objects managed by WMI are prefixed with Win32. If you select CIM_LogicalDisk and then ask to display an instance of it, it is not possible to see any specific information about the available logical drives, only to see the Win32_LogicalDisk entries for each available logical drive. Now, the right side of the window shows the properties of the Win32_LogicalDisk class. As you can see, the value of the property is empty, because we're looking at a class, not a specific instance of the class. To display an instance of the Win32_LogicalDisk class, click the Instances button on the right (fourth).



Figure Three

After clicking the Instances button, the window displays an instance of all the logical drives on the current machine, including the network logical drive. Click on an instance of the device ID "C:" To display the result of Figure four. The right pane contains the properties and methods of the current instance, and the name of the current logical drive appears above the right-hand pane.



Figure Four

You can use scripts to modify these properties or call these methods. If the meaning of an attribute is not clear, simply select the Win32_logialdisk class or the win32_logicaldisk.deviceid= "C:" instance, and then click the Help button. Most objects have a detailed description of their properties and methods.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.