3
votes

I'd like to toggle the Anonymous Authentication (Enabled/Disabled) setting found in IIS Manager (7.5, Windows 7), Default Web Site / My Website - Authentication / Anonymous Authentication using Powershell.

I'm not looking for something that alters a web.config file, but does exactly what IIS Manager does.

I've tried Set-WebConfiguration and Set-WebConfigurationProperty but not gotten close.

Can anyone provide an example?

1

1 Answers

9
votes

Try the Set-WebConfigurationProperty cmdlet:

Set-WebConfigurationProperty -Filter system.webServer/security/authentication/anonymousAuthentication `
                              -PSPath MACHINE/WEBROOT/APPHOST `
                              -Location 'Default Web Site' `
                              -Name Enabled `
                              -Value $true