다음을 통해 공유


구성 기준을 할당하는 방법

Configuration Manager 컬렉션에 구성 기준을 할당하기 위해 할당 instance 만들어지고 필요한 최소 값 집합으로 채워지고 저장됩니다.

구성 기준을 할당하려면

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

  2. 의 instance 만듭니다SMS_BaselineAssignment.

  3. instance 속성을 채웁다.

  4. SMS_BaselineAssignment instance 저장합니다.

예제

다음 코드 예제에서는 기준 할당의 instance 만드는 방법을 보여 줍니다.

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


Sub DCMCreateAssignment(swbemServices,                     _
                        baselineID,                        _
                        applyToSubTargets,                 _
                        assignmentAction,                  _
                        assignmentName,                    _
                        assignmentDescription,             _
                        desiredConfigType,                 _
                        distributionPointLocality,         _
                        evaluationSchedule,                _
                        logComplianceToWinEvent,           _
                        notifyUser,                        _
                        sendDetailedNonComplianceStatus,   _
                        startTime,                         _
                        suppressReboot,                    _
                        targetCollectionID,                _
                        useGMTTimes)

' Create new assignment object.
set newAssignment = swbemServices.Get("SMS_BaselineAssignment").SpawnInstance_()

' Assign variable values to assignment properties.
'    //
'    // The following properties are set by the provider on put():
'    //     AssignmentID
'    //     AssignmentUniqueID
'    //     SourceSite
'    //     CreationTime

newAssignment.ApplyToSubTargets = applyToSubTargets
newAssignment.AssignmentAction = assignmentAction
newAssignment.AssignmentName = assignmentName
newAssignment.AssignmentDescription = assignmentDescription
newAssignment.DesiredConfigType = desiredConfigType
newAssignment.DPLocality = distributionPointLocality
newAssignment.EvaluationSchedule = evaluationSchedule
newAssignment.LogComplianceToWinEvent = logComplianceToWinEvent
newAssignment.NotifyUser = notifyUser
newAssignment.SendDetailedNonComplianceStatus = sendDetailedNonComplianceStatus
newAssignment.StartTime = startTime
newAssignment.SuppressReboot = suppressReboot
newAssignment.TargetCollectionID = targetCollectionID
newAssignment.UseGMTTimes = useGMTTimes
newAssignment.AssignedCIs = Array(baselineID)

' Save assignment.
newAssignment.Put_

Wscript.Echo " "
Wscript.Echo "Created new assignment."

End Sub


public void DCMCreateAssignment(WqlConnectionManager connection,
                                bool applyToSubTargets,
                                int assignmentAction,
                                string assignmentName,
                                string assignmentDescription,
                                string desiredConfigType,
                                int distributionPointLocality,
                                string evaluationSchedule,
                                bool logComplianceToWinEvent,
                                bool notifyUser,
                                bool sendDetailedNonComplianceStatus,
                                string startTime,
                                int suppressReboot,
                                string targetCollectionID,
                                bool useGMTTimes,
                                int baselineID)
{

    // Set required variables.
    // Set AssignedCIs like array with a known baseline id (this is the initial creation of the assignment, so no existing values).
    int[] arrayBaselineNumbers = new int[] { baselineID };

    try
    {
        // Create new assignment object.
        IResultObject newAssignment = connection.CreateInstance("SMS_BaselineAssignment");

        // Assign variable values to assignment properties.
        //
        // The following properties are set by the provider on put():
        //     AssignmentID
        //     AssignmentUniqueID
        //     SourceSite
        //     CreationTime
        newAssignment["ApplyToSubTargets"].BooleanValue = applyToSubTargets;
        newAssignment["AssignmentAction"].IntegerValue = assignmentAction;
        newAssignment["AssignmentName"].StringValue = assignmentName;
        newAssignment["AssignmentDescription"].StringValue = assignmentDescription;
        newAssignment["DesiredConfigType"].StringValue = desiredConfigType;
        newAssignment["DPLocality"].IntegerValue = distributionPointLocality;
        newAssignment["EvaluationSchedule"].StringValue = evaluationSchedule;
        newAssignment["LogComplianceToWinEvent"].BooleanValue = logComplianceToWinEvent;
        newAssignment["NotifyUser"].BooleanValue = notifyUser;
        newAssignment["SendDetailedNonComplianceStatus"].BooleanValue = sendDetailedNonComplianceStatus;
        newAssignment["StartTime"].StringValue = startTime;
        newAssignment["SuppressReboot"].IntegerValue = suppressReboot;
        newAssignment["TargetCollectionID"].StringValue = targetCollectionID;
        newAssignment["AssignedCIs"].IntegerArrayValue = arrayBaselineNumbers;
        newAssignment["UseGMTTimes"].BooleanValue = useGMTTimes;

        // Save assignment object.
        newAssignment.Put();
    }
    catch (SmsException ex)
    {
        Console.WriteLine("Failed to create new assignment." + "\\n" + ex.Message);
        throw;
    }

    Console.WriteLine("Created new assignment.");

}

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

매개 변수 형식 설명
- connection
- swbemServices
-관리: WqlConnectionManager
- VBScript: SWbemServices
SMS 공급자에 대한 유효한 연결입니다.
applyToSubTargets -관리: Boolean
- VBScript: Boolean
true 구성 항목 할당을 하위 컬렉션에 적용합니다.
assignmentAction -관리: Integer
- VBScript: Integer
구성 항목 할당과 관련된 작업입니다.
assignmentName -관리: String
- VBScript: String
assignmentName
assignmentDescription -관리: String
- VBScript: String
로컬 할당 이름입니다.
desiredConfigType -관리: String
- VBScript: String
구성 항목의 형식입니다.
distributionPointLocality -관리: Integer
- VBScript: Integer
배포 지점 지역성에 따라 클라이언트가 배포 지점을 가져오는 방법을 결정하는 플래그입니다.
evaluationSchedule -관리: String
- VBScript: String
할당 평가 일정입니다.
logComplianceToWinEvent -관리: Boolean
- VBScript: Boolean
true준수 상태 Windows 이벤트 로그에 기록합니다.
notifyUser -관리: Boolean
- VBScript: Boolean
true 구성 항목을 사용할 수 있는 경우 사용자에게 알립니다.
sendDetailedNonComplianceStatus -관리: Boolean
- VBScript: Boolean
true자세한 비준수 상태 메시지를 보냅니다.
startTime -관리: String
- VBScript: String
구성 항목 할당이 처음 제공된 날짜 및 시간입니다.
suppressReboot -관리: Integer
- VBScript: Integer
구성 항목이 적용된 후 다시 부팅이 보류 중인 경우 클라이언트가 컴퓨터를 다시 부팅하지 않아야 하는지 여부를 나타내는 값입니다.
targetCollectionID -관리: String
- VBScript: String
할당이 대상으로 지정된 컬렉션의 식별자입니다.
useGMTTimes -관리: Boolean
- VBScript: Boolean
true 시간 및 일정이 UTC(유니버설 조정 시간)에 있으면 입니다.
baselineID - 관리형: Integer 배열
- VBScript: Integer 배열
할당 대상 구성 항목에 대한 ID의 배열입니다.

코드 컴파일

네임스페이스

시스템

System.Collections.Generic

System.ComponentModel

Microsoft.ConfigurationManagement.ManagementProvider

Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine

어셈블리

adminui.wqlqueryengine

microsoft.configurationmanagement.managementprovider

강력한 프로그래밍

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

.NET Framework 보안

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

참고 항목

구성 기준 및 구성 항목개체 정보 관리코드를 사용하여 Configuration Manager 공급자에 연결하는방법 WMI SMS_BaselineAssignment 서버 WMI 클래스를 사용하여 Configuration Manager 공급자에 연결하는 방법