-
Notifications
You must be signed in to change notification settings - Fork 149
xWebConfigKeyValue
Important
This resource has been renamed in the latest release, see WebConfigKeyValue. Bug fixes and new functionality will only be added to the renamed resource.
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
WebsitePath | Key | String | Path to website location(IIS or WebAdministration format) | |
ConfigSection | Key | String | Config Section to be update | AppSettings |
Key | Key | String | Key for AppSettings | |
Ensure | Write | String | Indicates if the property and value should be present or absent. Defaults to Present. |
Present , Absent
|
Value | Write | String | Value for AppSettings | |
IsAttribute | Write | Boolean | If the given key value pair is for attribute, default is element |
NOTE: The xWebConfigKeyValue resource is deprecated and has been replaced by the xWebConfigProperty and xWebConfigPropertyCollection resources. It may be removed in a future release.
- Target machine must be running Windows Server 2012 R2 or later.
All issues are not listed here, see here for all open issues.
Adds an app setting WebsiteTitle to the configuration file of the website. This example shows how to use the xWebConfigKeyValue DSC resource for adding an extra key and value to appSettings. It will add a key WebSiteTitle with value to the configuration of the site specified.
Configuration Sample_xWebConfigKeyValue_AddAppSetting
{
param
(
# Target nodes to apply the configuration.
[String[]] $NodeName = 'localhost',
# Target website to which the key should be added.
[String] $WebsiteName = 'Default Web Site'
)
# Import the modules that define custom resources
Import-DscResource -Module xWebAdministration
Node $NodeName
{
# Adds an extra app setting to the AppSettings section.
xWebConfigKeyValue DefaultSite
{
Ensure = 'Present'
ConfigSection = 'AppSettings'
Key = 'WebsiteTitle'
Value = 'xWebAdministration DSC Examples'
WebsitePath = 'IIS:\Sites\' + $WebsiteName
}
}
}
Removes an app setting WebsiteTitle from the configuration file of the website if present. This example shows how to use the xWebConfigKeyValue DSC resource for ensuring a key is not pressent in appSettings. It will remove a setting with key WebSiteTitle from the configuration of the site specified.
Configuration Sample_xWebConfigKeyValue_RemoveAppSetting
{
param
(
# Target nodes to apply the configuration.
[String[]] $NodeName = 'localhost',
# Target website from which the key should be removed.
[String] $WebsiteName = 'Default Web Site'
)
# Import the modules that define custom resources
Import-DscResource -Module xWebAdministration
Node $NodeName
{
# Removes an extra app setting from the AppSettings section.
xWebConfigKeyValue DefaultSite
{
Ensure = 'Absent'
ConfigSection = 'AppSettings'
Key = 'WebsiteTitle'
Value = 'xWebAdministration DSC Examples'
WebsitePath = 'IIS:\Sites\' + $WebsiteName
}
}
}
- 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