Adding Application Settings to a web site


I have been working on trying to get PowerShell to add information to the “Application Settings” for a web site. For the last week, I have been looking into this but there is not a lot of information on adding the information to the section.

I have been able to list out all the values:

`Get-WebConfigurationProperty -pspath ‘IIS:\Sites\Default Web Site’ -filter “/appSettings/add” -name * | ft`

I have been able to change a value:

`Set-WebConfigurtionProperty -pspath ‘IIS:\Sites\Default Web Site’ -filter “/appSettings/add[@key=‘MyValue’]” -name value -Value '1’`

But I have not been able to get the Add-WebConfigurtionProperty to allow a key and value to be placed in the site. I have tried many different ways to get this to work and looked for references for the Add-WebConfigurationProperty dealing with the key and values but I have not found anything has gotten me over the hump.

Thank you.

Can you share us the code you attempted. This will help us in understand better. May be it could be a small miss somewhere.