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 | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF file | WebAdministration.mof |