Test-IisConfigurationSection

Tests a configuration section.

Syntax

Test-IisConfigurationSection -SectionPath <String> [-SiteName <String>] [-VirtualPath <String>] [<CommonParameters>]
Test-IisConfigurationSection -SectionPath <String> [-SiteName <String>] [-VirtualPath <String>] -Locked [<CommonParameters>]

Description

You can test if a configuration section exists or wheter it is locked.

Beginning with Carbon 2.0.1, this function is available only if IIS is installed.

Parameters

Name Type Description Required? Pipeline Input Default Value
SectionPath String

The path to the section to test.

true false
SiteName String

The name of the site whose configuration section to test. Optional. The default is the global configuration.

false false
VirtualPath String

The optional path under SiteName whose configuration section to test.

false false
Locked SwitchParameter

Test if the configuration section is locked.

true false False

Return Values

System.Boolean.

EXAMPLE 1

Test-IisConfigurationSection -SectionPath 'system.webServer/I/Do/Not/Exist'

Tests if a configuration section exists. Returns False, because the given configuration section doesn't exist.

EXAMPLE 2

Test-IisConfigurationSection -SectionPath 'system.webServer/cgi' -Locked

Returns True if the global CGI section is locked. Otherwise False.

EXAMPLE 3

Test-IisConfigurationSection -SectionPath 'system.webServer/security/authentication/basicAuthentication' -SiteName `Peanuts` -VirtualPath 'SopwithCamel' -Locked

Returns True if the Peanuts website's SopwithCamel sub-directory's basicAuthentication security authentication section is locked. Otherwise, returns False.