I am trying to add the following to my web.config using a powershell script.

```
<system.webServer>
  <httpProtocol>
    <customHeaders>
      <clear />
      <add name="Access-Control-Allow-Origin" value="*" />
      <add name="Access-Control-Allow-Headers" value="Content-Type" />
      <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
    </customHeaders>
  </httpProtocol>

```

Here is the powershell code snippit that i have (Just including the top 1, the other two look the same)

```
Write-Host "Importing WebAdministration"
Import-Module WebAdministration 
cd IIS:\

$sitePath = ("IIS:\Sites\test.test1.com")

Write-Host "This works"
Set-WebConfigurationProperty system.web/sessionState $sitePath -Name mode -     Value Off

Write-Host "Does not work"
Set-WebConfigurationProperty -PSPath $sitePath -Filter 'system.webServer/httpProtocol/customHeaders/add[@name="Access-Control-Allow-Origin"]' -Name 'value' -Value '*' -Force

```

When this is executed i get the following result in octopus.

WARNING: Target configuration object 
'system.webServer/httpProtocol/customHeaders/Access-Control-Allow-Origin is not
 found at path 'MACHINE/WEBROOT/APPHOST/sub.mysite.com'.

The value is not added. I have imported the WebAdministration module, and most of the other settings work.