Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Most computer management activities, including troubleshooting computer problems, installing new software, and applying Group Policy, require comprehensive information about how a computer has been configured. This information includes such things as the:
The System Information snap-in has long been the tool of choice for system administrators needing comprehensive information about a computer, the hardware installed on that computer, and the software running on that computer. The System Information snap-in and a sample of the kind of information it can return are shown in Figure 8.1.
Figure 8.1 System Information Snap-in
System Information Snap-in
Although the System Information snap-in is a useful tool, it does have limitations that make it a less than optimal choice for performing inventories. In particular, this tool:
Although it is possible to manually export the data from within System Information, the resulting text file uses a free-form style of formatting that makes it difficult to parse the information and save it to a database.
To overcome these limitations, system administrators have typically turned to third-party tools. Depending on your needs, however, you can save considerable cost by creating custom Windows Management Instrumentation (WMI) scripts that replicate the full functionality of the System Information snap-in. Using a WMI script provides a number of advantages over the System Information snap-in:
For example, a script can be scheduled to run on a group of computers at a specific date and time.
For example, although System Information can retrieve the name and version number of the operating system, it cannot retrieve more detailed information such as the set of hot fixes that have been applied to the computer.
Table 8.1 lists the data fields found on the System Information Summary tab and the equivalent WMI classes and properties.
Table 8.1 System Information Fields and Equivalent WMI Classes and Properties
System Information Field | WMI Class and Property |
---|---|
OS Name | Win32_OperatingSystem.Name |
OS Version | Win32_OperatingSystem.Version |
Service Pack | Win32_OperatingSystem.ServicePackMajorVersion Win32_OperatingSystem.ServicePackMinorVersion |
OS Manufacturer | Win32_OperatingSystem.Manufacturer |
System Name | Win32_ComputerSystem.Name |
System Manufacturer | Win32_ComputerSystem.Manufacturer |
System Model | Win32_ComputerSystem.Model |
System Type | Win32_Processor.Architecture |
Processor | Win32_Processor.Description |
BIOS Version | Win32_BIOS.Version |
Windows Directory | Win32_OperatingSystem.WindowsDirectory |
Locale | Win32_OperatingSystem.Locale |
Time Zone | Win32_ComputerSystem.TimeZone |
Total Physical Memory | Win32_ComputerSystem.PhsyicalMemory |
Available Physical Memory | Win32_OperatingSystem.FreePhysicalMemory |
Total Virtual Memory | Win32_OperatingSystem.TotalVirtualMemory |
Available Virtual Memory | Win32_OperatingSystem.AvailableVirtualMemory |
Page File Space | Win32_OperatingSystem.SizeStoredInPagingFiles |
Listing 8.1 contains a script that retrieves the specified system information for a computer. To carry out this task, the script must perform the following steps:
This query returns a collection consisting of all the operating systems installed on the computer.
Separate calls are required because WMI allows you to connect to only a single class at a time.
Listing 8.1 Retrieving System Information
|
|
Send us your feedback | « Previous | Next » |