업데이트 목록을 만드는 방법
Configuration Manager SMS_AuthorizationList 클래스의 인스턴스를 만들고 속성을 채워 소프트웨어 업데이트 집합이 포함된 업데이트 목록을 만듭니다.
업데이트 목록을 만들려면
SMS 공급자에 대한 연결을 설정합니다.
클래스를 사용하여 새 업데이트 목록 개체를 만듭니다
SMS_AuthorizationList
.새 업데이트 목록 속성을 채웁 수 있습니다.
새 업데이트 목록 및 속성을 저장합니다.
예시
다음 예제 메서드는 클래스의 인스턴스 SMS_AuthorizationList
를 만들고 속성을 채워 소프트웨어 업데이트 집합을 포함하는 업데이트 목록을 만드는 방법을 보여 줍니다.
중요
이 예제에서 사용되는 속성에는 LocalizedInformation
설명 정보의 개체 배열(포함된 배열)이 필요합니다.
예제 LocaleID
에서 속성은 영어(미국)로 하드 코딩됩니다. 미국 이외 지역의 로캘이 필요한 경우 설치를 SMS_Identification 서버 WMI 클래스LocaleID
속성에서 가져올 수 있습니다.
샘플 코드 호출에 대한 자세한 내용은 코드 조각 Configuration Manager 호출을 참조하세요.
다음 예제에서는 Visual Basic의 서브루틴 호출을 보여줍니다.
' Prework for CreateSUMUpdateList
' Create the array of CI_IDs.
dim newUpdates
newUpdates = Array(9)
' Create and populate an SMS_CI_LocalizedProperties object.
set SMSCILocalizedProperties = swbemservices.Get("SMS_CI_LocalizedProperties").SpawnInstance_
SMSCILocalizedProperties.Description = "Test Description"
SMSCILocalizedProperties.DisplayName = "Test Display Name"
SMSCILocalizedProperties.InformativeURL = "Test URL"
SMSCILocalizedProperties.LocaleID = "1033"
' Create an array to hold the SMS_CI_LocalizedProperties object.
dim newDescriptionInfo
newDescriptionInfo = Array(SMSCILocalizedProperties)
' Call the CreateSUMUpdateList method.
Call CreateSUMUpdateList(swbemServices, _
newUpdates, _
newDescriptionInfo)
다음 예제에서는 C#의 메서드 호출을 보여줍니다.
// Prework for CreateSUMUpdateList
// Create array list (to hold the array of Localized Properties).
List<IResultObject> newDescriptionInfo = new List <IResultObject>();
IResultObject SMSCILocalizedProperties = WMIConnection.CreateEmbeddedObjectInstance("SMS_CI_LocalizedProperties");
// Populate the initial array values (this could be a loop to added more localized info).
SMSCILocalizedProperties["Description"].StringValue = "4 CI_IDs - 9,34,53,72 ";
SMSCILocalizedProperties["DisplayName"].StringValue = "Test Display Name";
SMSCILocalizedProperties["InformativeURL"].StringValue = "Test URL";
SMSCILocalizedProperties["LocaleID"].StringValue = "1033";
// Add the 'embedded properties' to newDescriptionInfo.
newDescriptionInfo.Add(SMSCILocalizedProperties);
// Create the array of CI_IDs.
int[] newCI_ID = new int[] { 9, 34, 53, 72 };
// Call the CreateSUMUpdateList method.
SUMSnippets.CreateSUMUpdateList(WMIConnection,
newCI_ID,
newDescriptionInfo);
Sub CreateSUMUpdateList(connection, _
newUpdates, _
newDescriptionInfo)
' Create the new UpdateList object.
Set newUpdateList = connection.Get("SMS_AuthorizationList").SpawnInstance_
' Populate the UpdateList properties.
' Updates is an int32 array that maps to the CI_ID in SMS_SoftwareUpdate.
newUpdateList.Updates = newUpdates
' Need to pass embedded properties (LocalizedInformation) here.
newUpdateList.LocalizedInformation = newDescriptionInfo
' Save the new UpdateList and properties.
newUpdateList.Put_
' Output the new UpdateList name.
Wscript.Echo "Created Update List " & newUpdateList.LocalizedDisplayName
End Sub
public void CreateSUMUpdateList(WqlConnectionManager connection,
int [] newUpdates,
List<IResultObject> newDescriptionInfo)
{
try
{
// Create the new SMS_AuthorizationList object.
IResultObject newUpdateList = connection.CreateInstance("SMS_AuthorizationList");
// Populate the new SMS_AuthorizationList object properties.
// Updates is an int32 array that maps to the CI_ID in SMS_SoftwareUpdate.
newUpdateList["Updates"].IntegerArrayValue = newUpdates;
// Pass embedded properties (LocalizedInformation) here.
newUpdateList.SetArrayItems("LocalizedInformation", newDescriptionInfo);
// Save changes.
newUpdateList.Put();
Console.WriteLine();
Console.WriteLine("Created Update List. " );
}
catch (SmsException ex)
{
Console.WriteLine("Failed to create update list. Error: " + ex.Message);
throw;
}
}
예제 메서드에는 다음 매개 변수가 있습니다.
매개 변수 | 형식 | 설명 |
---|---|---|
Connection |
-관리: WqlConnectionManager - VBScript: SWbemServices |
SMS 공급자에 대한 유효한 연결입니다. |
newUpdates |
- 관리형: Integer 배열- VBScript: Integer array |
업데이트 목록과 연결된 업데이트의 배열입니다. |
newDescriptionInfo |
- 관리형: Object 배열- VBScript: Object array |
형식 LocalizedInformation 의 개체 배열(포함된 속성)입니다. |
코드 컴파일
이 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 참조하세요.