How to Initiate a One-time Membership Evaluation for a Collection
Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager
To Initiate a One-time Membership Evaluation
Set up a connection to the SMS Provider.
Get the specific collection instance by using the collection ID provided.
Refresh the collection membership using the RequestRefresh Method in Class SMS_Collection method.
Example
The following example method refreshes the collection membership for a specific collection.
For information about calling the sample code, see Calling Configuration Manager Code Snippets.
Sub RefreshCollection(connection, collectionID) Dim collection Set collection = connection.Get("SMS_Collection.CollectionID='" & collectionID & "'") Call collection.RequestRefresh()End Sub
public void RefreshCollection(WqlConnectionManager connection, string collectionID){ IResultObject collection = connection.GetInstance(string.Format("SMS_Collection.CollectionID='{0}'", collectionID)); collection.ExecuteMethod("RequestRefresh", null);}
The example method has the following parameters:
Parameter |
Type |
Description |
---|---|---|
connection |
|
A valid connection to the SMS Provider. |
collectionID |
Unique auto-generated ID containing eight characters. For more information, see the CollectionID property of SMS_Collection Server WMI Class. |
Compiling the Code
The C# example requires:
Namespaces
System
Microsoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
Assembly
adminui.wqlqueryengine
microsoft.configurationmanagement.managementprovider
mscorlib
Robust Programming
For more information about error handling, see About Configuration Manager Errors.
See Also
Configuration Manager Collections
SMS_Collection Server WMI Class