Skip to content

Latest commit

 

History

History
100 lines (75 loc) · 5.12 KB

configuredobject-getallsections-method.md

File metadata and controls

100 lines (75 loc) · 5.12 KB
title description ms.date ms.assetid
ConfiguredObject.GetAllSections Method1
Describes the ConfiguredObject.GetAllSectionsMethod1 property and provides the property's syntax, parameters, return value, example, and requirements.
10/07/2016
4c7fc67c-c762-1cc8-b9b4-6cb0a099dc57

ConfiguredObject.GetAllSections Method1

Retrieves all configuration sections under a configured object.

Syntax

ConfiguredObject.GetAllSections(Sections);  
ConfiguredObject.GetAllSections Sections  

Parameters

Name Description
Sections A ConfigurationSection variable into which the configuration sections for the configured object are copied.

Return Value

This method does not return a value.

Remarks

The GetAllSections method is useful for discovering the full set of available sections for a configured object. For regular setting and getting of configuration properties, see the ConfiguredObject.GetSection method.

Note

The GetAllSections method signature contains an [OUT] parameter that receives the sections that the method returns.

Example

The following example retrieves the Site object for the default Web site and uses the GetAllSections method to retrieve and enumerate the configuration section objects for the site.

Only one instance of each section is returned. The returned values are the effective configuration for the level of the ConfiguredObject that is being used. The path for all returned objects will match that of the ConfiguredObject.

Note

Only the objects at the level of the ConfiguredObject that you specify will be returned.

' Connect to the WMI WebAministration namespace.  
Set oWebAdmin = _  
    GetObject("winmgmts:root\WebAdministration")  
  
' Get the default Web site.  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
  
' Retrieve all configuration sections for the default Web  
' site and place them into an array variable.  
oSite.GetAllSections arySect  
  
' Display the number of configuration sections.  
WScript.Echo "There are " & UBound(arySect) + 1 & _  
    " configuration sections for [" & oSite.Name & "]."  
WScript.Echo vbCrLf  
  
' Iterate through the sections.  
For aryIdx = 0 To UBound(arySect)  
  
    ' Number the section for display.  
    WScript.Echo aryIdx + 1 & "."  
  
    ' Show the section name.  
    WScript.Echo "[" & arySect(aryIdx).Path_.Class & "]"  
  
    ' Show the section path and location.  
    WScript.Echo "Path: " & arySect(aryIdx).Path  
    WScript.Echo "Location: " & arySect(aryIdx).Location  
  
    ' Show the SectionInformation properties.  
    WScript.Echo "SectionInformation.OverrideMode: " & _  
        arySect(aryIdx).SectionInformation.OverrideMode  
    WScript.Echo _  
        "SectionInformation.EffectiveOverrideMode: " & _  
        arySect(aryIdx).SectionInformation.EffectiveOverrideMode  
    WScript.Echo "SectionInformation.IsLocked: " & _  
        arySect(aryIdx).SectionInformation.IsLocked  
    WScript.Echo "SectionInformation.LockItem: " & _  
        arySect(aryIdx).SectionInformation.LockItem  
  
    WScript.Echo vbCrLf  
Next  
  

Requirements

Type Description
Client - [!INCLUDEiis70] on [!INCLUDEwinvista]
- [!INCLUDEiis75] on [!INCLUDEwin7]
- [!INCLUDEiis80] on [!INCLUDEwin8]
- [!INCLUDEiis100] on [!INCLUDEwin10]
Server - [!INCLUDEiis70] on [!INCLUDEwinsrv2008]
- [!INCLUDEiis75] on [!INCLUDEwinsrv2008r2]
- [!INCLUDEiis80] on [!INCLUDEwinsrv2012]
- [!INCLUDEiis85] on [!INCLUDEwinsrv2012r2]
- [!INCLUDEiis100] on [!INCLUDEwinsrv2016]
Product - [!INCLUDEiis70], [!INCLUDEiis75], [!INCLUDEiis80], [!INCLUDEiis85], [!INCLUDEiis100]
MOF file WebAdministration.mof

See Also

ConfiguredObject Class
ConfiguredObject.GetSection Method