업데이트 구성 및 배포하는 방법

Configuration Manager SMS_UpdatesAssignment 서버 WMI 클래스의 인스턴스를 만들고 속성을 채워 소프트웨어 업데이트 배포를 만듭니다.

업데이트를 구성하고 배포하려면

  1. SMS 공급자에 대한 연결을 설정합니다.

  2. SMS_UpdatesAssignment 클래스를 사용하여 새 배포 개체를 만듭니다.

  3. 새 배포 속성을 채웁 수 있습니다.

  4. 새 배포 및 속성을 저장합니다.

예시

다음 예제 메서드는 SMS_UpdatesAssignment 클래스를 사용하여 소프트웨어 업데이트 배포를 만드는 방법을 보여 줍니다. 예제 메서드의 매개 변수는 의 특정 속성을 반영합니다 SMS_UpdatesAssignment.

중요

아래 메서드에는 할당된 구성 항목(CI_IDs)의 배열이 필요합니다. 이러한 CI_IDs 대한 업데이트 콘텐츠는 이미 다운로드되어 업데이트 배포 패키지에 추가되어 있어야 합니다.

샘플 코드 호출에 대한 자세한 내용은 코드 조각 Configuration Manager 호출을 참조하세요.


Sub ConfigureAndDeploySUMUpdates(connection,                             _  
                                  newApplyToSubTargets,                  _  
                                  newArrayAssignedCIs,                   _  
                                  newAssignmentAction,                   _  
                                  newAssignmentDescription,              _  
                                  newAssignmentName,                     _  
                                  newDesiredConfigType,                  _  
                                  newDPLocality,                         _   
                                  newLocaleID,                           _  
                                  newLogComplianceToWinEvent,            _  
                                  newNotifyUser,                         _  
                                  newRaiseMomAlertsOnFailure,            _  
                                  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.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 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["SendDetailedNonComplianceStatus"].BooleanValue = newSendDetailedNonComplianceStatus;  
        newSUMUpdatesAssignment["StartTime"].DateTimeValue = 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;  
    }  
}  

예제 메서드에는 다음 매개 변수가 있습니다.

매개 변수 형식 설명
Connection -관리: WqlConnectionManager
- VBScript: SWbemServices
SMS 공급자에 대한 유효한 연결입니다.
newApplyToSubTargets -관리: Boolean
-Vbscript: Boolean
배포가 하위 대상 집합에 적용되는지 여부를 결정합니다.

-사실
-False
newArrayAssignedCIs - 관리형: Integer 배열
- VBScript: Integer array
할당된 구성 항목(CI_IDs)의 배열입니다. 이러한 CI_IDs 대한 업데이트 콘텐츠는 이미 다운로드되어 업데이트 배포 패키지에 추가되어 있어야 합니다.
newAssignmentAction -관리: Integer
-Vbscript: Integer
새 할당 작업입니다.
newAssignmentDescription -관리: String
-Vbscript: String
새 할당 설명입니다.
newAssignmentName -관리: String
-Vbscript: String
새 할당 이름입니다.
newDesiredConfigType -관리: Integer
-Vbscript: Integer
원하는 새 구성 유형입니다.
newDPLocality -관리: Integer
-Vbscript: Integer
새 배포 지점 지역입니다.
newLocaleID -관리: Integer
-Vbscript: Integer
새 로캘 ID입니다.
newLogComplianceToWinEvent -관리: Boolean
-Vbscript: Boolean
규정 준수가 Windows 이벤트 로그에 기록되는지 여부를 결정합니다.

-사실
-False
newNotifyUser -관리: Boolean
-Vbscript: Boolean
사용자에게 알림을 받을지 여부를 식별합니다.

-사실
-False
newRaiseMomAlertsOnFailure -관리: Boolean
-Vbscript: Boolean
실패 시 MOM 경고가 발생하는지 여부를 식별합니다.

-사실
-False
newSendDetailedNonComplianceStatus -관리: Boolean
-Vbscript: Boolean
자세한 비준수 상태가 전송되는지 여부를 식별합니다.

-사실
-False
newStartTime -관리: String
-Vbscript: String
새 시작 시간입니다.
newSuppressReboot -관리: Integer
-Vbscript: Integer
다시 부팅이 표시되지 않는지 여부를 식별합니다.
newTargetCollectionID -관리: String
-Vbscript: String
새 대상 컬렉션 ID입니다.
newUseGMTTimes -관리: Boolean
-Vbscript: Boolean
UTC(협정 세계시)를 사용할지 여부를 식별합니다.

-사실
-False

코드 컴파일

이 C# 예제에는 다음이 필요합니다.

네임 스페이스

시스템

System.Collections.Generic

System.Text

Microsoft. ConfigurationManagement.ManagementProvider

Microsoft. ConfigurationManagement.ManagementProvider.WqlQueryEngine

어셈블리

adminui.wqlqueryengine

microsoft.configurationmanagement.managementprovider

강력한 프로그래밍

오류 처리에 대한 자세한 내용은 Configuration Manager 오류 정보를 참조하세요.

.NET Framework 보안

Configuration Manager 애플리케이션 보안에 대한 자세한 내용은 역할 기반 관리 Configuration Manager 참조하세요.

참고 항목

소프트웨어 업데이트 배포 정보

SMS_UpdatesAssignment