Managed Resources

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

Managed resources are the fundamental layer in the WMI architecture. A managed resource is any logical or physical component that can be accessed and managed by using WMI. Windows resources that can be managed by using WMI include the computer system, disks, peripheral devices, event logs, files, folders, file systems, networking components, operating system subsystems, performance counters, printers, processes, registry settings, security, services, shared folders, SAM users and groups, Active Directory, Windows Installer, Windows Driver Model (WDM) device drivers, and SNMP Management Information Base (MIB) data.

A WMI-managed resource communicates with WMI through a provider. As you begin to write scripts to interact with WMI-managed resources, you will often see the term instance used to refer to a virtual representation of the managed resource in the running script. According to the WMI SDK, an instance is "a representation of a real-world managed object that belongs to a particular class."

In more concrete terms, an instance represents an actual implementation of something WMI can manage. For example, suppose you run the script shown in Listing 6.5, which returns the drive letter for each logical disk drive on a computer.

Listing 6.5   Retrieving and Displaying Logical Disk Drive Information

1 2 3 4 5 6 7 8 
strComputer = "." Set objSWbemServices = GetObject("winmgmts:\\" & strComputer) Set colSWbemObjectSet = objSWbemServices.InstancesOf("Win32_LogicalDisk") For Each objSWbemObject In colSWbemObjectSet     Wscript.Echo objSWbemObject.DeviceID Next

Depending on the logical disk drives on your computer, the script will return output similar to this:

A: C: D: E: 

Each of these drive letters represents two things: 1) a real, live logical disk drive installed (or mapped) on the computer and 2) an instance of the Win32_LogicalDiskDrive class.

Note

  • But what if there are no instances of a class? For example, suppose you run a script that returns information about all the tape drives on a computer, only no tape drives are on the computer. Will that generate an error? No; after all, Win32_TapeDrive is a valid WMI class. It just happens that no actual tape drives (no instances of the class) are installed on the computer.

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net