How to Set the Local Software Updates Schedule
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
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
Create a CCMUpdatesDeployment instance by using the CCMUpdatesDeployment COM class.
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
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
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 |
|
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 |
|
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
Concepts
System Center Configuration Manager Software Development Kit
Configuration Manager Software Updates
About Software Updates Client
CPAppletMgr Client COM Automation Class
CCMUpdatesDeployment COM Automation Class
ICCMUpdatesDeployment::SetUserDefinedSchedule Method