다음을 통해 공유


ConfiguredObject.GetSection 메서드

구성된 개체에 대한 구성 섹션의 내용을 검색합니다.

구문

ConfiguredObject.GetSection(SectionName, Section);  
ConfiguredObject.GetSection SectionName, Section  

매개 변수

속성 Description
SectionName string 검색할 구성 섹션의 이름을 포함하는 변수입니다(예: "BasicAuthenticationSection").
Section 구성 섹션의 내용이 배치되는 ConfigurationSection 변수입니다.

반환 값

이 메서드는 값을 반환하지 않습니다.

설명

메서드를 GetSection 사용하여 원하는 구성 섹션의 내용을 검색하고 구성 가능한 속성을 설정할 수 있습니다.

참고

메서드 서명에는 GetSection 섹션 이름에 대한 매개 변수와 메서드가 반환하는 [OUT] section 개체의 매개 변수가 포함 [IN] 됩니다.

예제

다음 예제에서는 기본 웹 사이트에 대한 HTTP 오류 섹션을 가져오고 해당 배열 및 비 배열 속성을 모두 표시합니다.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
' Get the default Web site.  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
  
' Get the HTTP errors section by using the GetSection method.  
oSite.GetSection "HttpErrorsSection", oSection  
  
' Display a heading.  
WScript.Echo "=============================="  
WScript.Echo "Http Errors Section Properties"  
WScript.Echo "=============================="  
  
' Display the HttpErrorsSection non-array properties.  
For Each vProp In oSection.Properties_  
    If (vProp.Name <> "HttpErrors") And _  
        (vProp.Name <> "SectionInformation") Then  
        WScript.Echo vProp.Name & ": " & vProp.Value  
    End If  
Next  
WScript.Echo   
  
' Display the HttpErrorsSection SectionInformation properties.  
WScript.Echo "HttpErrorsSection.SectionInformation"  
WScript.Echo "------------------------------------"  
For Each vProp In oSection.SectionInformation.Properties_  
    WScript.Echo vProp.Name & ": " & vProp.Value  
Next  
WScript.Echo  
  
' Display the contents of the HttpErrors array property.  
WScript.Echo "HttpErrorsSection.HttpErrors"  
WScript.Echo "----------------------------"  
For Each oHttpErrorElement In oSection.HttpErrors  
    For Each vProp In oHttpErrorElement.Properties_  
        WScript.Echo vProp.Name & ": " & vProp.Value  
    Next  
    WScript.Echo  
Next  
  

요구 사항

형식 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

참고 항목

ConfigurationSection 클래스
ConfiguredObject 클래스
HttpErrorElement 클래스
HttpErrorsSection 클래스