다음을 통해 공유


ConfigurationSectionWithCollection.Get 메서드

구성 섹션에서 컬렉션의 지정된 멤버를 검색합니다.

구문

ConfigurationSectionWithCollection.Get   
   CollectionName,   
   ElementIdentifier,   
   CollectionElement;  
ConfigurationSectionWithCollection.Get   
CollectionName,   
ElementIdentifier,   
CollectionElement  

매개 변수

속성 Description
CollectionName string 검색할 컬렉션의 이름을 포함하는 값입니다(예: "모듈"). 컬렉션 이름은 중첩된 컬렉션을 나타낼 수 있으며 인덱스를 사용할 수 있습니다. 인덱스가 0부터 시작하는 정수 인덱스 또는 문자열(예: [9] 또는 "KeyProperty='Value'")일 수 있습니다. 자세한 내용은 주의 섹션을 참조하세요. 참고:CollectionName 해당 WMI 클래스의 이름이 아니라 구성 파일에 있는 섹션의 이름입니다(예: "ModulesSection"이 아닌 "Modules").
ElementIdentifier string 검색할 컬렉션 요소의 키 속성 및 값을 지정하는 값입니다. 문자열은 "KeyProperty1='Value1',KeyProperty2='Value2',..." 형식이어야 합니다. (예: "Name='RoleManager'").
CollectionElement 검색된 컬렉션 요소를 배치할 CollectionElement 개체 변수입니다(예: oModule).

반환 값

void.

설명

이 메서드는 컬렉션의 멤버를 하나만 검색하려는 경우에 유용합니다.

다음 예제에서는 매개 변수에 대한 구문 변형을 CollectionName 보여 줍니다.

다음 구문은 문자열 기반 "KeyProperty='Value'" 인덱스를 사용하고 중첩된 컬렉션을 지정하는 매개 변수를 보여줍니다CollectionName.

traceFailedRequests[path='Rule_2'].TraceAreas.TraceAreas

0부터 시작하는 인덱스로 동일한 값을 지정할 수 있습니다.

traceFailedRequests[1].TraceAreas.TraceAreas

매개 변수가 ElementIdentifier 이고 출력 변수가 CollectionElementoTraceAreaElement인 경우 메서드에 대한 전체 호출은 Get 다음 구문과 같을 수 "provider='ASP'" 있습니다.

oSection.Get _

"traceFailedRequests[path='Rule_2'].TraceAreas.TraceAreas", _

"provider='ASP'", oTraceAreaElement

다음 구문은 0부터 시작하는 인덱스가 있는 전체 호출을 보여줍니다.

oSection.Get _

"traceFailedRequests[1].TraceAreas.TraceAreas", _

"provider='ASP'", oTraceAreaElement

예제

다음 예제에서는 ApplicationHost.config 파일의 섹션에서 모듈 <modules>RoleManager 이름과 형식을 검색합니다.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' First, get the <modules> section by using the inherited   
' WMI Get method on the WMI class name of the section  
' (that is, "ModulesSection").  
Set oSection = oWebAdmin.Get( _  
    "ModulesSection.Path='MACHINE/WEBROOT/APPHOST/'," & _  
    "Location=''")  
  
' Display the path.   
WScript.Echo "Path: " & oSection.Path_.RelPath  
  
' Retrieve the RoleManager member of the collection.  
' This is the ConfigurationSectionWithCollection.Get method,  
' so use the collection name found in the configuration file  
' (that is, "Modules").  
oSection.Get "Modules", "Name='RoleManager'", oModule  
  
' Display the module name and type.  
WScript.Echo "Module Name: " & oModule.Name  
WScript.Echo "Module Type: " & oModule.Type  
  
' Output:  
' Path: ModulesSection.Location="",Path="MACHINE/WEBROOT/APPHOST/"  
' Module Name: RoleManager  
' Module Type: System.Web.Security.RoleManagerModule  
  

요구 사항

형식 Description
클라이언트 - Windows Vista의 IIS 7.0
- Windows 7의 IIS 7.5
- Windows 8의 IIS 8.0
- WINDOWS 10 IIS 10.0
서버 - Windows Server 2008의 IIS 7.0
- Windows Server 2008 R2의 IIS 7.5
- Windows Server 2012의 IIS 8.0
- Windows Server 2012 R2의 IIS 8.5
- WINDOWS SERVER 2016 IIS 10.0
제품 - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF 파일 WebAdministration.mof

참고 항목

CollectionElement 클래스
ConfigurationSectionWithCollection 클래스
ModuleAction 클래스
ModulesSection 클래스
TraceAreaElement 클래스
TraceFailedRequestsSection 클래스
TraceUrl 클래스
TraceUrlAreaSettings 클래스