Hello All,
Using DSC i am trying to set a number of web server properties in IIS.
I’ve had a look at the xWebadministration resource and its great and I use it for setting a number of things.
However, it doesn’t look to me like it supports setting a number of things at a server level rather than site level.
Ok, to get round that i can create a script resource that does a number of Set-webconfigurationProperty things.
I have 14 things to set. Now i’ve got it working by breaking it up into multiple script resources, for example,
Script IIS_1 { GetScript = { @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Result = (Get-WebConfigurationProperty /system.applicationhost/confighistory -name path.value) } } setScript = { Set-WebConfigurationProperty /system.applicationhost/confighistory -name path -value "d:\inetpub\history" } Testscript = { (Get-WebConfigurationProperty /system.applicationhost/confighistory -name path.value) -eq "d:\inetpub\history" } }
Now i can set the next property by creating a new script resource and just copying the above but replacing the configuration property.
However, i think there must be a better way of achieving this by just looping through each webconfigurationproperty and checking and setting where appropriate. I am struggling though to see how this can be done
regards
Dan