-
Notifications
You must be signed in to change notification settings - Fork 149
WebConfigProperty
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
WebsitePath | Key | String | Path to website location (IIS or WebAdministration format). | |
Filter | Key | String | Filter used to locate property to update. | |
PropertyName | Key | String | Name of the property to update. | |
Ensure | Write | String | Indicates if the property and value should be present or absent. Defaults to Present. |
Present , Absent
|
Value | Write | String | Value of the property to update. |
The WebConfigProperty
DSC resource is used to ensure the value of an
identified property in the web.config file.
- Target machine must be running Windows Server 2012 R2 or later.
All issues are not listed here, see here for all open issues.
Disables directory browsing in the default website.
This example shows how to use the WebConfigProperty DSC resource for setting a configuration property. It will set the value of the system.webServer/directoryBrowse enabled attribute to false in the Web.config file for the default website.
Configuration Sample_WebConfigProperty_Add
{
param
(
# Target nodes to apply the configuration.
[Parameter()]
[String[]]
$NodeName = 'localhost'
)
# Import the modules that define custom resources
Import-DscResource -ModuleName WebAdministrationDsc
Node $NodeName
{
WebConfigProperty "$($NodeName) - Ensure 'directory browsing' is set to disabled - Add"
{
WebsitePath = 'IIS:\Sites\Default Web Site'
Filter = 'system.webServer/directoryBrowse'
PropertyName = 'enabled'
Value = 'false'
Ensure = 'Present'
}
}
}
Removes configuration of directory browsing in the default website.
This example shows how to use the WebConfigProperty DSC resource for removing a configuration property. It will remove the system.webServer/directoryBrowse enabled attribute (if present) in the Web.config file for the default website.
Configuration Sample_WebConfigProperty_Remove
{
param
(
# Target nodes to apply the configuration.
[Parameter()]
[String[]]
$NodeName = 'localhost'
)
# Import the modules that define custom resources
Import-DscResource -ModuleName WebAdministrationDsc
Node $NodeName
{
WebConfigProperty "$($NodeName) - Ensure 'directory browsing' is set to disabled - Remove"
{
WebsitePath = 'IIS:\Sites\Default Web Site'
Filter = 'system.webServer/directoryBrowse'
PropertyName = 'enabled'
Ensure = 'Absent'
}
}
}
- Home
- IisFeatureDelegation
- IisLogging
- IisMimeTypeMapping
- IisModule
- SslSettings
- WebApplication
- WebApplicationHandler
- WebAppPool
- WebAppPoolDefaults
- WebConfigProperty
- WebConfigPropertyCollection
- WebSite
- WebSiteDefaults
- WebVirtualDirectory
- xIisFeatureDelegation
- xIisHandler
- xIisLogging
- xIisMimeTypeMapping
- xIisModule
- xSslSettings
- xWebApplication
- xWebAppPool
- xWebAppPoolDefaults
- xWebConfigKeyValue
- xWebConfigProperty
- xWebConfigPropertyCollection
- xWebSite
- xWebSiteDefaults
- xWebVirtualDirectory