ConfiguredObject.GetAllSections Method1
構成されたオブジェクトのすべての構成セクションを取得します。
構文
ConfiguredObject.GetAllSections(Sections);
ConfiguredObject.GetAllSections Sections
Parameters
件名 | 説明 |
---|---|
Sections |
構成されたオブジェクトの構成セクションをコピーする先の ConfigurationSection 変数。 |
戻り値
このメソッドは値を返しません。
解説
GetAllSections
メソッドは、構成されたオブジェクトで使用可能なセクションの完全なセットを検出するのに役立ちます。 構成プロパティの通常の設定と取得については、ConfiguredObject.GetSection メソッドを参照してください。
Note
GetAllSections
メソッド シグネチャには、メソッドが返すセクションを受け取る [OUT]
パラメーターが含まれています。
例
次の例では、既定の Web サイトの Site オブジェクトを取得し、GetAllSections
メソッドを使用してサイトの構成セクション オブジェクトを取得して列挙します。
各セクションのインスタンスは 1 つだけ返されます。 返される値は、使用されている ConfiguredObject のレベルに対する有効な構成です。 返されるすべてのオブジェクトのパスは、ConfiguredObject
のパスと一致します。
Note
指定した ConfiguredObject
のレベルのオブジェクトのみが返されます。
' 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
要件
型 | 説明 |
---|---|
クライアント | - 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 |
Product | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 |
MOF ファイル | WebAdministration.mof |