I have a need to modify the applicationHost.config file located by default at c:\windows\System32\inetsrv\config.
Reviewing the XML file, there are many entries for location under configuration. I need to modify only a specific one. Perhaps checking if it exists first before modifying it?
The following XML is what I want to modify. The is nested under the top level configuration. I want to change just one entry, anonymousAuthentication enabled="true" if found to be false.
<location path="Default Web Site/MyWebsite/SiteA">
<system.webServer>
<security>
<authentication>
<digestAuthentication enabled="false" />
<basicAuthentication enabled="false" />
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true">
<providers>
<clear />
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
</security>
</system.webServer>
</location>
A side note. I do see that I could use set-webconfigurationproperty. However, when I do so, it tells me the configuration section cannot be used at this path. This happens when the section is locked at a parent level. I'm using PSPath, which is supposed to get around that, but it's not working.
set-webconfigurationproperty