We have a project to set up a site's configuration with powershell. I need to know how to Set Anonymous Access to true and set the credentials to a domain user
I found a blog with script example to get the current state from the web.config of the application Blog click here
PS C:\ > $iis = new-object Microsoft.Web.Administration.ServerManager
PS C:\ > $iis.Sites | foreach {
$_.Applications | where { $_.ApplicationPoolName -eq 'DefaultAppPool' } |
select-object Path,@{Name="AnonymousEnabled"; Expression = {
$_.GetWebConfiguration().GetSection("system.webServer/security/authentication/anonymousAuthentication").GetAttributeValue("enabled")
}}
}
But if it is not set through web.config, how do i get it from the mroot config (machine.config?) and how do I modify the value to make sure it is set to true and set the username and password? any help will be much appreciated.