Trying to enable Windows authentication on one site and disable on 3 others with the following Powershell script:
Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/windowsAuthentication' -Name Enabled -Value True -location IIS:\Sites\$Sitename\$CompanyNumber
Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/AnonymousAuthentication' -Name Enabled -Value False -Location IIS:\Sites\$Sitename\$CompanyNumber
Have also tried this:
Set-WebConfigurationProperty-Filter"/system.webServer/security/authentication/anonymousAuthentication"-NameEnabled-ValueFalse-PSPath IIS:\ -Location"$Sitename/$CompanyName"
Set-WebConfigurationProperty-Filter"/system.webServer/security/authentication/windowsAuthentication"-NameEnabled-ValueTrue-PSPath IIS:\ -Location"$Sitename/$CompanyName"
This is ran on ONE site, the other 3 are using the same script(With name changes only) but Windows auth is false and Anonymous auth is True. Goal is to have 1 site using windows authentication and the other 3 using Anonymous. The script runs with no error, but afterwards Anonymous is turned on for all 4 sites.