You set the local software updates schedule, in Microsoft System Center Configuration Manager 2007, by creating an instance of the CCMUpdatesDeployment COM Automation Class and by using the SetUserDefinedSchedule method.

To set the local software updates schedule

  1. Create a CCMUpdatesDeployment instance by using the CCMUpdatesDeployment COM class.

  2. Set the schedule by using the using the SetUserDefinedSchedule method.

Example

The following example method shows how to set the local software updates schedule by using the CCMUpdatesDeployment COM class and the SetUserDefinedSchedule method.

For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects

Visual Basic Script  Copy Code
Sub SetLocalSoftwareUpdateSchedule(newRecurrence, newHour)

	 ' Initialize the updatesDeployment variable.
	dim updatesDeployment


	' Create the COM object.
	set updatesDeployment = CreateObject ("UDA.CCMUpdatesDeployment")

	' Set the local schedule by using the SetUserDefinedSchedule method
	' and the recurrence and hour values passed in.
	updatesDeployment.SetUserDefinedSchedule newRecurrence, newHour

	' Output success message.
	wscript.echo "Set Local Software Update Schedule."

End Sub
C#  Copy Code
public void setLocalSoftwareUpdatesSchedule(uint newRecurrenceDay,uint newHour)
{
	try
	{
		// Create the UpdatesDeployment instance.
		UPDATESDEPLOYMENTLib.CCMUpdatesDeploymentClass newCCMUpdatesDeployment = new UPDATESDEPLOYMENTLib.CCMUpdatesDeploymentClass();

		// Run the action.
		newCCMUpdatesDeployment.SetUserDefinedSchedule(newRecurrenceDay, newHour);

		// Output success message.
		Console.WriteLine("Ran SetUserDefinedSchedule.");
}

	catch (COMException ex)
	{
		Console.WriteLine("Failed to run SetUserDefinedSchedule method. Error: " + ex.Message);
		throw;
}

}

The example method has the following parameters:

Parameter

Type

Description

newRecurrence

  • Managed: Integer

  • VBScript: Integer

The day value to set for software update recurrence.

Possible values are:

0 - NONE

1 - SUNDAY

2 - MONDAY

3 - TUESDAY

4 - WEDNESDAY

5 - THURSDAY

6 - FRIDAY

7 - SATURDAY

8 - DAILY

newHour

  • Managed: Integer

  • VBScript: Integer

The hour value to set for software update recurrence.

Possible values are:

0 through 23

Compiling the Code

This C# example requires:

Namespaces

System

System.Runtime.InteropServices

UPDATESDEPLOYMENTLib COM Automation Library

COM Automation

The reference that is needed for early binding is UpdatesDeploymentAgent 1.0 Type Library. This creates a type library reference named UPDATESDEPLOYMENTLib. The early binding object name for the Control Panel Manager is CCMUpdatesDeploymentClass.

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


Send comments about this topic to Microsoft.