Share via


상태 마이그레이션 지점에 대한 Restore-Only 모드를 설정하는 방법

Configuration Manager SMPQuiesceState 임베디드 속성을 설정하여 사용자 데이터를 저장하는 새 요청을 거부하도록 운영 체제 배포 상태 마이그레이션 지점을 구성합니다.

SMPQuiesceState 에는 두 가지 가능한 값이 있습니다.

정의
0 복원 전용 모드가 꺼져 있습니다.
1 복원 전용 모드가 켜져 있습니다.

상태 마이그레이션 지점에 대한 복원 전용 모드를 설정하려면

  1. SMS 공급자에 대한 연결을 설정합니다. 자세한 내용은 SMS 공급자 기본 사항을 참조하세요.

  2. 사이트 제어 파일의 상태 마이그레이션 지점 리소스 섹션에 연결합니다.

  3. 포함된 속성을 가져옵니다.

  4. SMPQuiesceState를 업데이트합니다.

  5. 변경 내용을 사이트 제어 파일에 커밋합니다.

예시

다음 예제 메서드는 제공된 값에 따라 복원 전용 모드를 설정합니다.

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

Sub SetRestoreOnlyMode(connection,          _  
                       context,           _  
                       siteCode,               _  
                       enableRestoreOnlyMode)  

    ' Load site control file and get SMS State Migration Point section.  
    connection.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteCode & """", "Refresh", , , context  

    Query = "SELECT * FROM SMS_SCI_SysResUse " & _  
            "WHERE RoleName = 'SMS State Migration Point' " & _  
            "AND SiteCode = '" & siteCode & "'"  

    Set SCIComponentSet = connection.ExecQuery(Query, , , context)  

    ' Only one instance is returned from the query.  
    For Each SCIComponent In SCIComponentSet  

         ' Display state migration point server name.  
         wscript.echo "SMS State Migration Point Server: " & SCIComponent.NetworkOSPath                                      

        ' Loop through the array of embedded property instances.  
        For Each vProperty In SCIComponent.Props  

            ' Setting: SMPQuiesceState  
            If vProperty.PropertyName = "SMPQuiesceState" Then  
                wscript.echo " "  
                wscript.echo vProperty.PropertyName  
                wscript.echo "Current value " &  vProperty.Value                 

                ' Modify the value.  
                vProperty.Value = enableRestoreOnlyMode  
                wscript.echo "New value " & enableRestoreOnlyMode  
            End If  

        Next     

             ' Update the component in your copy of the site control file. Get the path  
             ' to the updated object, which could be used later to retrieve the instance.  
             Set SCICompPath = SCIComponent.Put_( , context)  
    Next  

    ' Commit the change to the actual site control file.  
    Set InParams = connection.Get("SMS_SiteControlFile").Methods_("CommitSCF").InParameters.SpawnInstance_  
    InParams.SiteCode = siteCode  
    connection.ExecMethod "SMS_SiteControlFile", "CommitSCF", InParams, , context  
End Sub  
public void SetRestoreOnlyMode(  
    WqlConnectionManager connection,  
    string server,   
    string siteCode,   
    bool enableRestoreOnlyMode)  
{  
    try  
    {  
        // Get the site control file.  
        IResultObject ro = connection.GetInstance("SMS_SCI_SysResUse.FileType=2,ItemName='[\"Display=\\\\" + server + "\\\"]MSWNET:[\"SMS_SITE=" + siteCode + "\"]\\\\" + server + "\\,SMS State Migration Point',ItemType='System Resource Usage',SiteCode='" + siteCode + "'");  

        // Get the embedded properties.  
        Dictionary<string, IResultObject> embeddedProperties = ro.EmbeddedProperties;  

        // Set the restore only mode.  
        embeddedProperties["SMPQuiesceState"]["Value"].BooleanValue = enableRestoreOnlyMode;  

        ro.EmbeddedProperties = embeddedProperties;  

        // Commmit the changes.  
        ro.Put();  
    }  
    catch (SmsException e)  
    {  
        Console.WriteLine("Failed to set restore only mode" + e.Message);  
        throw;  
    }  
}  

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

매개 변수 형식 설명
connection -관리: WqlConnectionManager
- VBScript: SWbemServices
SMS 공급자에 대한 유효한 연결입니다.
context (VBScript) -Vbscript: SWbemContext 유효한 컨텍스트 개체입니다. 자세한 내용은 WMI를 사용하여 Configuration Manager 컨텍스트 한정자를 추가하는 방법을 참조하세요.
server -관리: String
-Vbscript: String
상태 마이그레이션 지점이 실행 중인 Configuration Manager 서버입니다.
siteCode -관리: String
-Vbscript: String
Configuration Manager 사이트 코드입니다.
enableRestoreOnlyMode -관리: Boolean
-Vbscript: Integer
복원 전용 모드를 설정합니다.

- 관리: true 복원 모드만 켜고, 그렇지 않으면 false입니다.
- VBScript: 1 복원 모드를 켜고, 그렇지 않으면 0입니다.

코드 컴파일

C# 예제에는 다음과 같은 컴파일 요구 사항이 있습니다.

네임 스페이스

시스템

System.Collections.Generic

System.Text

Microsoft. ConfigurationManagement.ManagementProvider

Microsoft. ConfigurationManagement.ManagementProvider.WqlQueryEngine

어셈블리

microsoft.configurationmanagement.managementprovider

adminui.wqlqueryengine

강력한 프로그래밍

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

.NET Framework 보안

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

참고 항목

OS 배포 사이트 역할 구성관리 코드를 사용하여 Configuration Manager 사이트 제어 파일에 읽고 쓰는 방법
WMI를 사용하여 Configuration Manager 사이트 제어 파일에 읽고 쓰는 방법