0
我们有一个项目用PowerShell设置网站的配置。我需要知道如何设置匿名访问为true,并设置凭据的域用户在powershell中实际设置IIS设置
我发现剧本例如博客从应用 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")
}}
}
的web.config中获取的当前状态
但是,如果它不是通过web.config设置的,我如何从mroot配置文件(machine.config?)中获取它,并且如何修改该值以确保它设置为true并设置用户名和密码?任何帮助都感激不尽。
这篇文章可能会帮助你,请按照@AUSTX_RJL评论我的答案给出的链接。 http://stackoverflow.com/questions/13058537/configuring-iis-with-powerhsell-enable-forms-authentication/13058814#13058814 – dugas
@Shay Levy的回答:http://stackoverflow.com/questions/18136128/toggle-iis -7-5-authentication-anonymous-authentication-with-powershell-3-0也许可以帮助你引导你。 – dugas