How to Configure and Deploy Updates
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 create a software updates deployment, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_UpdatesAssignment Server WMI Class and populating the properties.
To configure and deploy updates
Set up a connection to the SMS Provider.
Create the new deployment object by using the SMS_UpdatesAssignment class.
Populate the new deployment properties.
Save the new deployment and properties.
Example
The following example method shows how to create a software updates deployment by using the SMS_UpdatesAssignment class. Note that the parameters of the example method reflect certain properties of SMS_UpdatesAssignment.
Important
The methods below require an array of the assigned configuration items (CI_IDs). The update content for these CI_IDs must have already been downloaded and added to an updates deployment package.
For information about calling the sample code, see Calling Configuration Manager Code Snippets.
Sub ConfigureAndDeploySUMUpdates(connection, _
newApplyToSubTargets, _
newArrayAssignedCIs, _
newAssignmentAction, _
newAssignmentDescription, _
newAssignmentName, _
newDesiredConfigType, _
newDPLocality, _
newLocaleID, _
newLogComplianceToWinEvent, _
newNotifyUser, _
newRaiseMomAlertsOnFailure, _
newReadOnly, _
newSendDetailedNonComplianceStatus, _
newStartTime, _
newSuppressReboot, _
newTargetCollectionID, _
newUseGMTTimes)
' Create the new deployment object.
Set newSUMUpdatesAssignment = connection.Get("SMS_UpdatesAssignment").SpawnInstance_
' Populate the deployment properties.
newSUMUpdatesAssignment.ApplyToSubTargets = newApplyToSubTargets
newSUMUpdatesAssignment.AssignedCIs = newArrayAssignedCIs
newSUMUpdatesAssignment.AssignmentAction = newAssignmentAction
newSUMUpdatesAssignment.AssignmentDescription = newAssignmentDescription
newSUMUpdatesAssignment.AssignmentName = newAssignmentName
newSUMUpdatesAssignment.DesiredConfigType = newDesiredConfigType
newSUMUpdatesAssignment.DPLocality = newDPLocality
newSUMUpdatesAssignment.LocaleID = newLocaleID
newSUMUpdatesAssignment.LogComplianceToWinEvent = newLogComplianceToWinEvent
newSUMUpdatesAssignment.NotifyUser = newNotifyUser
newSUMUpdatesAssignment.RaiseMomAlertsOnFailure = newRaiseMomAlertsOnFailure
newSUMUpdatesAssignment.ReadOnly = newReadOnly
newSUMUpdatesAssignment.SendDetailedNonComplianceStatus = newSendDetailedNonComplianceStatus
newSUMUpdatesAssignment.StartTime = newStartTime
newSUMUpdatesAssignment.SuppressReboot = newSuppressReboot
newSUMUpdatesAssignment.TargetCollectionID = newTargetCollectionID
newSUMUpdatesAssignment.UseGMTTimes = newUseGMTTimes
' Save the new deployment and properties.
newSUMUpdatesAssignment.Put_
' Output the new deployment name.
Wscript.Echo "Created new deployment " & newSUMUpdatesAssignment.AssignmentName
End Sub
public void ConfigureAndDeploySUMUpdates(WqlConnectionManager connection,
bool newApplyToSubTargets,
int[] newArrayAssignedCIs,
int newAssignmentAction,
string newAssignmentDescription,
string newAssignmentName,
int newDesiredConfigType,
int newDPLocality,
int newLocaleID,
bool newLogComplianceToWinEvent,
bool newNotifyUser,
bool newRaiseMomAlertsOnFailure,
bool newReadOnly,
bool newSendDetailedNonComplianceStatus,
string newStartTime,
int newSuppressReboot,
string newTargetCollectionID,
bool newUseGMTTimes)
{
try
{
// Create the deployment object.
IResultObject newSUMUpdatesAssignment = connection.CreateInstance("SMS_UpdatesAssignment");
// Populate new deployment properties.
// Note: newTemplateName must be unique.
newSUMUpdatesAssignment["ApplyToSubTargets"].BooleanValue = newApplyToSubTargets;
newSUMUpdatesAssignment["AssignedCIs"].IntegerArrayValue = newArrayAssignedCIs;
newSUMUpdatesAssignment["AssignmentAction"].IntegerValue = newAssignmentAction;
newSUMUpdatesAssignment["AssignmentDescription"].StringValue = newAssignmentDescription;
newSUMUpdatesAssignment["AssignmentName"].StringValue = newAssignmentName;
newSUMUpdatesAssignment["DesiredConfigType"].IntegerValue = newDesiredConfigType;
newSUMUpdatesAssignment["DPLocality"].IntegerValue = newDPLocality;
newSUMUpdatesAssignment["LocaleID"].IntegerValue = newLocaleID;
newSUMUpdatesAssignment["LogComplianceToWinEvent"].BooleanValue = newLogComplianceToWinEvent;
newSUMUpdatesAssignment["NotifyUser"].BooleanValue = newNotifyUser;
newSUMUpdatesAssignment["RaiseMomAlertsOnFailure"].BooleanValue = newRaiseMomAlertsOnFailure;
newSUMUpdatesAssignment["ReadOnly"].BooleanValue = newReadOnly;
newSUMUpdatesAssignment["NotifyUser"].BooleanValue = newNotifyUser;
newSUMUpdatesAssignment["SendDetailedNonComplianceStatus"].BooleanValue = newSendDetailedNonComplianceStatus;
newSUMUpdatesAssignment["StartTime"].StringValue = newStartTime;
newSUMUpdatesAssignment["SuppressReboot"].IntegerValue = newSuppressReboot;
newSUMUpdatesAssignment["TargetCollectionID"].StringValue = newTargetCollectionID;
newSUMUpdatesAssignment["UseGMTTimes"].BooleanValue = newUseGMTTimes;
// Save new deployment and new deployment properties.
newSUMUpdatesAssignment.Put();
// Output the new deployment name.
Console.WriteLine("Created deployment: " + newAssignmentName);
}
catch (SmsException ex)
{
Console.WriteLine("Failed to create newSUMUpdatesAssignment. Error: " + ex.Message);
throw;
}
}
The example method has the following parameters:
Parameter |
Type |
Description |
Connection |
|
A valid connection to the SMS Provider. |
newApplyToSubTargets |
|
Determines whether the deployment applies to subtargets.
|
newArrayAssignedCIs |
|
An array of the assigned configuration items (CI_IDs). The update content for these CI_IDs must have already been downloaded and added to an updates deployment package. |
newAssignmentAction |
|
The new assignment action. |
newAssignmentDescription |
|
The new assignment description. |
newAssignmentName |
|
The new assignment name. |
newDesiredConfigType |
|
The new desired configuration type. |
newDPLocality |
|
The new distribution point locality. |
newLocaleID |
|
The new locale ID. |
newLogComplianceToWinEvent |
|
Determines whether compliance is logged to the Windows Event log.
|
newNotifyUser |
|
Identifies whether users are notified.
|
newRaiseMomAlertsOnFailure |
|
Identifies whether MOM alerts are raised on failure.
|
newReadOnly |
|
Identifies whether the deployment is read only.
|
newSendDetailedNonComplianceStatus |
|
Identifies whether detailed noncompliance status is sent.
|
newStartTime |
|
The new start time. |
newSuppressReboot |
|
Identifies whether reboot is suppressed. |
newTargetCollectionID |
|
The new target collection IDs. |
newUseGMTTimes |
|
Identifies whether to use Coordinated Universal Time (UTC).
|
Compiling the Code
This C# example requires:
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
Concepts
System Center Configuration Manager Software Development Kit
Configuration Manager Software Updates
Software Updates Deployments
About Software Updates Deployments
SMS_UpdatesAssignment Server WMI Class