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.
Visual Basic Script | ![]() |
---|---|
Sub RefreshCollection(connection, collectionID) Dim collection Set collection = connection.Get("SMS_Collection.CollectionID='" & collectionID & "'") Call collection.RequestRefresh() End Sub |
C# | ![]() |
---|---|
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.