You synchronize the software update point, in System Center 2012 Configuration Manager SP1, by calling the SyncNow method.

To synchronize the software update point

  1. Set up a connection to the SMS Provider.

  2. Create an instance of the SMS_SoftwareUpdate Server WMI Class class.

  3. Create and populate the method parameter value fullSync.

  4. Call the SyncNow Method in Class SMS_SoftwareUpdate method, passing in the method parameter value.

Example

The following example method shows how to synchronize the software update point by calling the SyncNow Method in Class SMS_SoftwareUpdate method.

For information about calling the sample code, see Calling Configuration Manager Code Snippets.

C#  Copy Code
public void SynchronizeSoftwareUpdatePoint(WqlConnectionManager connection) 
{
	try
	{

		// Create the new SMS_SoftwareUpdate object. 
		IResultObject newSoftwareUpdate = connection.CreateInstance("SMS_SoftwareUpdate");

		// Create dictionary object to pass parameters to the SyncNow method. 
		Dictionary<string, object> inParams = new Dictionary<string, object>();
		inParams["fullSync"] = true; 

		// Initialize the outParams object. 
		IResultObject outParams = null; 

		// Call SyncNow method to initiate synchronization. 
		outParams = connection.ExecuteMethod("SMS_SoftwareUpdate", "SyncNow", inParams); 
				 
}
	catch (SmsException ex) 
	{
		Console.WriteLine("Failed. Error: " + ex.InnerException.Message); 
}
}

The example method has the following parameters:

Parameter

Type

Description

connection

  • Managed: WqlConnectionManager

A valid connection to the SMS Provider.

Compiling the Code

The C# example has the following compilation requirements:

Namespaces

System

System.Collections.Generic

System.Text

Microsoft.ConfigurationManagement.ManagementProvider

Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine

Assembly

adminui.wqlqueryengine

microsoft.configurationmanagement.managementprovider

Robust Programming

For more information about error handling, see About Configuration Manager Errors.

Security

For more information about securing Configuration Manager applications, see Securing Configuration Manager Applications.

See Also