Powershell - Unable to disable Anonymous Authentication in IIS for a website
<p>When I use the following Powerhell script the anonymous authentification for the my website in IIS is not changing from 'Enabled' to 'Disabled'. Could anybody help please:-</p>

<pre><code>Import-Module WebAdministration

Set-WebConfigurationProperty -filter /system.webServer/security/authentication/anonymousAuthentication -name enabled -value false -PSPath IIS:\Sites\myWebsite -Force
</code></pre>

<p>I also tried this:-</p>

<pre><code>    Set-WebConfigurationProperty -filter /system.webServer/security/authentication/anonymousAuthentication -name disable -value true -PSPath IIS:\Sites\myWebsite -Force
</code></pre>

<p>I have also tried:-</p>

<pre><code>Set-WebConfigurationProperty -filter '/system.webServer/security/authentication/anonymousAuthentication' -name enabled -value false -PSPath IIS:\Sites\myWebsite -Force
</code></pre>

<p>I have also tried this but stil does not work:-</p>

<pre><code>Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value False -PSPath 'IIS:\' -Location "Sites\myWebsite"
</code></pre>

<p>I am not getting any errors. It appears that the script runs successfully. </p>

<p>Also, does anybody know how I would set forms Authentication to disabled too?</p>

<p>So looks like I am able to set the authentication to 'Enabled' if I do this:- </p>

<pre><code>Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value true -Location "IIS:\Sites\myWebsite"
</code></pre>

<p>But I can not set the Authentication to 'Disabled' if I do this:-</p>

<pre><code>Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value false -Location "IIS:\Sites\myWebsite"
</code></pre>