Compartir a través de


Get-IISConfigSection

Get-IISConfigSection

Gets a configuration section object to work further with the IIS Configuration Store.

Sintaxis

Parameter Set: Default
Get-IISConfigSection [[-SectionPath] <String> ] [[-CommitPath] <String> ] [[-Location] <String> ] [-InformationAction <ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <String> ] [ <CommonParameters>]

Descripción detallada

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).

Parámetros

-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.

Alias

none

¿Necesario?

false

¿Posición?

2

Valor predeterminado

none

¿Aceptar la entrada de la canalización?

true(ByPropertyName)

¿Aceptar caracteres comodín?

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

Alias

infa

¿Necesario?

false

¿Posición?

named

Valor predeterminado

none

¿Aceptar la entrada de la canalización?

false

¿Aceptar caracteres comodín?

false

-InformationVariable<String>

Specifies a variable in which to store an information event message.

Alias

iv

¿Necesario?

false

¿Posición?

named

Valor predeterminado

none

¿Aceptar la entrada de la canalización?

false

¿Aceptar caracteres comodín?

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.

Alias

none

¿Necesario?

false

¿Posición?

3

Valor predeterminado

none

¿Aceptar la entrada de la canalización?

true(ByPropertyName)

¿Aceptar caracteres comodín?

false

-SectionPath<String>

Specifies the name of the IIS configuration section for which a configuration object is returned.

Alias

none

¿Necesario?

false

¿Posición?

1

Valor predeterminado

none

¿Aceptar la entrada de la canalización?

true(ByValue,ByPropertyName)

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, vea  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de objetos que se pueden canalizar al cmdlet.

  • string, string[]

Salidas

El tipo de resultado es el tipo de los objetos que el cmdlet emite.

  • Microsoft.Web.Administration.ConfigurationSection, Microsoft.Web.Administration.ConfigurationSection[]

Ejemplos

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

Temas relacionados

Get-IISServerManager

IIS Administration Cmdlets