powershell - 删除IIS授权规则 "All users"

标签 powershell iis authorization

我尝试从我们的一项 Web 服务中删除特定的 IIS 授权规则。 我需要删除模式为“允许”的用户“所有用户”。

我尝试使用这个命令

Clear-Webconfiguration -Filter /system.webServer/security/authorization -Force -PSPath 'IIS:\sites\IAI Application Customizer'

我可以删除所有创建的规则,但只有“所有用户”规则仍然存在。

我希望你能帮我解决这个问题。 谢谢

最佳答案

这是一个已知问题,我至少可以使用 IIS7 重现该问题:https://social.technet.microsoft.com/Forums/en-US/46cb1905-424e-4bf1-a9e4-514e274b7582/iis-clearwebconfiguration-cmdlet-needs-to-be-executed-twice-for-inherited-url-authorization-rules?forum=winserverpowershell

您必须调用 Clear-WebConfiguration 两次才能删除所有继承的规则。示例:

Clear-WebConfiguration -Filter "/system.webServer/security/authorization/add[@users='*' and @roles='' and @verbs='']" -PSPath "IIS:\Sites\my_site"
Clear-WebConfiguration -Filter "/system.webServer/security/authorization/add[@users='*' and @roles='' and @verbs='']" -PSPath "IIS:\Sites\my_site"
Add-WebConfiguration -Filter "/system.webServer/security/authorization" -Value (@{AccessType="Allow"; Users="my_user"; Permissions="Read, Write"}) -PSPath "IIS:\Sites\my_site"

关于powershell - 删除IIS授权规则 "All users",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35598618/

相关文章:

windows - Powershell' 不是内部或外部命令,也不是可运行的程序 或批处理文件

Windows 上的 PHP : How to use web services with the logged on user's identity?

ASP.NET 友好 URL

asp.net - 如何部署和保护 ASP.NET Web 应用程序以供内部和外部用户使用?

c++ - 如何在运行时检查程序代码的更改

powershell - PowerShell 模块中的变量

Powershell - 与可执行文件的命令行提示交互?

powershell - 将任何 URL 重定向到 netsh 创建的托管网络 (Windows) 中的给定 IP (Localhost)

authorization - Web Api token 过期错误

apache - SVN 限制对除子目录之外的所有内容的访问