共用方式為


WMI Configuration Manager Provider Fundamentals

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

Windows Script Host-based applications and scripts work in Windows Management Instrumentation (WMI) through the WMI Object Model, which defines the programming interface to WMI. A number of WMI object types are used when manipulating Configuration Manager 2007 objects. For more information about the WMI Object Model, see the https://go.microsoft.com/fwlink/?linkid=31917.

In simple Configuration Manager scripts, you use the following WMI object types:

  • SWbemLocator

  • SWbemServices

  • SWbemObjectSet

  • SWbemObject

Note

Understanding WMI Query Language (WQL) queries is very important for identifying which Configuration Manager objects you want to read. WQL statements allow you to retrieve Configuration Manager objects that are based on SQL-like queries. For example, the following WQL statement is used to identify all Windows Server 2003 systems:

SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='SMS000FS'

For more information about using VBScript and WMI, see How to Use Configuration Manager Objects with WMI.

SWbemLocator

The https://go.microsoft.com/fwlink/?LinkId=44208object is used to create an authenticated connection to the SMS Provider. You use https://go.microsoft.com/fwlink/?LinkId=44210 method to make the connection to the SMS Provider. This method is particularly useful if you need to pass user credentials to a remote Configuration Manager server during connection. You can also use the Windows Script Host https://go.microsoft.com/fwlink/?LinkId=43953 method to create an authenticated connection. The type of object that is returned by GetObject depends on the parameters that are passed to it. See How to Connect to an SMS Provider in Configuration Manager by Using Managed Code and How to Connect to an SMS Provider in Configuration Manager by Using WMI for examples that show how to use either SWbemLocator or GetObject in your connection script.

SWbemServices

The https://go.microsoft.com/fwlink/?LinkId=44211 object represents an authenticated connection to a SMS Provider, and it is the object that you use to retrieve Configuration Manager objects. You receive an SWbemServices object as the return value of the SWbemLocator function ConnectServer or, alternatively, as the return value when the GetObject method is used to connect to the SMS Provider. SWbemServices has several methods, but you use only the https://go.microsoft.com/fwlink/?LinkId=44213, https://go.microsoft.com/fwlink/?LinkId=44215, and https://go.microsoft.com/fwlink/?LinkId=44214 methods for retrieving objects.

Get returns a single instance of a Configuration Manager object (SWbemObject). ExecQuery and InstancesOf return Configuration Manager objects in a collection (SWbemObjectSet) of Configuration Manager objects.

SWbemObjectSet

The https://go.microsoft.com/fwlink/?LinkId=44216 object represents a collection of Configuration Manager objects. You can use it to enumerate through the collection and read individual instances of the Configuration Manager object (SWbemObject) that you are interested in. You typically get a SWbemObjectSet object returned to you from the SWbemServices retrieval functions.

SWbemObject

The SWbemObject object allows you to access the properties and other information for a Configuration Manager object.

See Also

Concepts

SMS Provider in Configuration Manager
Configuration Manager Programming Fundamentals
How to Use Configuration Manager Objects with WMI