Get-IISConfigSection
Get-IISConfigSection
Gets a configuration section object to work further with the IIS Configuration Store.
構文
Parameter Set: Default
Get-IISConfigSection [[-SectionPath] <String> ] [[-CommitPath] <String> ] [[-Location] <String> ] [-InformationAction <ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <String> ] [ <CommonParameters>]
詳細説明
The Get-IISConfigSection cmdlet gets a configuration section (Microsoft.Web.Administration.ConfigurationSection) object to work further with the Internet Information Services (IIS) Configuration Store. It is generally the first cmdlet to use if configuration is to be read or updated. The output of this cmdlet can be passed to other cmdlets in the pipeline where ConfigurationElement objects are expected, since ConfigurationSection inherits from ConfigurationElement.
If the SectionPath parameter is not used, the cmdlet lists all the available sections. The sections that can be used are either defined in the applicationHost.config (IIS Configuration) or root web.config (.NET Framework).
パラメーター
-CommitPath<String>
Specifies the path where the configuration will be retrieved from. If CommitPath is omitted, applicationHost.config or root .NET configuration (root web.config) will be used.
Aliases |
none |
必須/オプション |
false |
位置 |
2 |
既定値 |
none |
パイプライン入力の受け入れ |
true(ByPropertyName) |
ワイルドカード文字の受け入れ |
false |
-InformationAction<ActionPreference>
Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are:
-- SilentlyContinue
-- Stop
-- Continue
-- Inquire
-- Ignore
-- Suspend
Aliases |
infa |
必須/オプション |
false |
位置 |
named |
既定値 |
none |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
-InformationVariable<String>
Specifies a variable in which to store an information event message.
Aliases |
iv |
必須/オプション |
false |
位置 |
named |
既定値 |
none |
パイプライン入力の受け入れ |
false |
ワイルドカード文字の受け入れ |
false |
-Location<String>
Specifies the name of the IIS configuration location for which a configuration object is returned. This corresponds to the <location> tag in configuration files.
Aliases |
none |
必須/オプション |
false |
位置 |
3 |
既定値 |
none |
パイプライン入力の受け入れ |
true(ByPropertyName) |
ワイルドカード文字の受け入れ |
false |
-SectionPath<String>
Specifies the name of the IIS configuration section for which a configuration object is returned.
Aliases |
none |
必須/オプション |
false |
位置 |
1 |
既定値 |
none |
パイプライン入力の受け入れ |
true(ByValue,ByPropertyName) |
ワイルドカード文字の受け入れ |
false |
<CommonParameters>
このコマンドレットは共通のパラメーターをサポートしています(-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、および -OutVariable)。詳細については、TechNet の「 「about_CommonParameters」 (https://go.microsoft.com/fwlink/p/?LinkID=113216) を参照してください。
入力
入力型は、コマンドレットにパイプできるオブジェクトの型です。
- string, string[]
出力
出力型は、コマンドレットが出力するオブジェクトの型です。
- Microsoft.Web.Administration.ConfigurationSection, Microsoft.Web.Administration.ConfigurationSection[]
使用例
Example 1: Get a configuration section object for a section path
This command gets the configuration section object for the system.applicationHost/sites section.
PS C:\> $ConfigSection = Get-IISConfigSection -SectionPath "system.applicationHost/sites"
Example 2: Get process state information for an IIS website
This command gets runtime state information for the Default Web Site.
PS C:\> $ConfigSection = Get-IISConfigSection -SectionPath "system.applicationHost/sites"
Get-IISConfigCollection $configSection | Get-IISConfigCollectionElement -ConfigAttribute @{"Name"="Default Web Site"} | Get-IISConfigAttributeValue -AttributeName "State"
Example 3: Add a new default document at the global configuration level
This command adds filename MyDefDoc.htm to the <files> collection of the <defaultDocument> section of the applicationHost.config file.
PS C:\> Get-IISConfigSection -SectionPath "system.webServer/defaultDocument" | Get-IISConfigCollection -CollectionName "files" | New-IISConfigCollectionElement -ConfigAttribute @{"Value" = "MyDefDoc.htm"}
Example 4: Create an application pool
This command creates an application pool and stores the result in variable $ConfigSectionCollection.
PS C:\> Start-IISCommitDelay
PS C:\> $ConfigSectionCollection = Get-IISConfigSection –SectionPath "system.applicationHost/applicationPools" | Get-IISConfigCollection
PS C:\> New-IISConfigCollectionElement -ConfigCollection $configSectionCollection -ConfigAttribute @{Name = "MyNewSiteAppPool"; autoStart=$true; managedPipelineMode="Integrated" }
PS C:\> Stop-IISCommitDelay