Configuration Manager 운영 체제 배포 마이그레이션을 추적하는 방법
SMS_StateMigration 클래스를 검사하여 Configuration Manager 운영 체제 마이그레이션을 추적합니다.
StoreCreationDate
, StoreDeletionDate
및 StoreReleaseDate
속성을 사용하여 마이그레이션의 현재 상태를 식별할 수 있습니다.
상태 마이그레이션을 추적하려면
SMS 공급자에 대한 연결을 설정합니다. 자세한 내용은 SMS 공급자 기본 사항을 참조하세요.
SMS_StateMigration 인스턴스를 가져옵니다.
,
StoreDeletionDate
및StoreReleaseDate
속성을 사용하여StoreCreationDate
현재 마이그레이션 상태를 계산합니다.
예시
다음 예제 메서드는 모든 마이그레이션을 열거하고 진행 중인지 여부를 결정합니다.
샘플 코드 호출에 대한 자세한 내용은 코드 조각 Configuration Manager 호출을 참조하세요.
Sub MigrationState(connection)
Dim migrations
Dim migration
Dim inProgress
Dim zeroTime
zeroTime = "00000000000000.000000+***"
Set migrations = connection.ExecQuery( "Select * From SMS_StateMigration")
For Each migration in Migrations
inProgress=False
If migration.StoreCreationDate<>zeroTime Then
If migration.StoreReleaseDate = zeroTime Then
inProgress=True
Else If migration.StoreDeletionDate = zeroTime Then
inProgress = True
Else
inProgress = false
End If
End If
Else
inProgress=False
End If
WScript.StdOut.Write "Migration " + migration.MigrationID
If inProgress = True Then
Wscript.Echo " is in progress"
Else
WScript.Echo " is not in progress"
End If
Next
End Sub
public void MigrationState(WqlConnectionManager connection)
{
try
{
IResultObject migrations =
connection.QueryProcessor.ExecuteQuery("Select * from SMS_StateMigration");
string zeroTime = "00000000000000.000000+***";
foreach (IResultObject migration in migrations)
{
Boolean inProgress = false;
if (migration["StoreCreationDate"].DateTimeValue.Equals(zeroTime) == false)
{
if (migration["StoreReleaseDate"].DateTimeValue.Equals(zeroTime) == true)
{
inProgress = true;
}
else if (migration["StoreDeletionDate"].DateTimeValue.Equals(zeroTime) == true)
{
inProgress = true;
}
else
{
inProgress = false;
}
}
else
{
inProgress = false;
}
Console.Write("Migration " + migration["MigrationID"].StringValue);
if (inProgress)
{
Console.WriteLine(" is in progress");
}
else
{
Console.WriteLine(" is not in progress");
}
}
}
catch (SmsException e)
{
Console.WriteLine("Failed while displaying migration state: " + e.Message);
throw;
}
}
예제 메서드에는 다음 매개 변수가 있습니다.
매개 변수 | 형식 | 설명 |
---|---|---|
connection |
-관리: WqlConnectionManager - VBScript: SWbemServices |
SMS 공급자에 대한 유효한 연결입니다. |
코드 컴파일
C# 예제에는 다음과 같은 컴파일 요구 사항이 있습니다.
네임 스페이스
시스템
System.Collections.Generic
Microsoft. ConfigurationManagement.ManagementProvider
Microsoft. ConfigurationManagement.ManagementProvider.WqlQueryEngine
어셈블리
microsoft.configurationmanagement.managementprovider
adminui.wqlqueryengine
강력한 프로그래밍
오류 처리에 대한 자세한 내용은 Configuration Manager 오류 정보를 참조하세요.
.NET Framework 보안
Configuration Manager 애플리케이션 보안에 대한 자세한 내용은 역할 기반 관리 Configuration Manager 참조하세요.
참고 항목
개체 개요관리 코드를 사용하여 Configuration Manager SMS 공급자에 연결하는 방법
WMI를 사용하여 Configuration Manager SMS 공급자에 연결하는 방법
OS 배포 컴퓨터 관리 정보