我有语法来添加最初的受限制的IP。 我只是需要语法来删除所有的IPs自动化的目的。
C:\Windows\System32\inetsrv\appcmd.exe set config "ParentSite" /section:system.webServer/security/ipSecurity /allowUnlisted:false /commit:apphost C:\Windows\System32\inetsrv\appcmd.exe set config "ParentSite" /section:system.webServer/security/ipSecurity /+"[ipaddress='192.168.1.100',allowed='true'" /commit:apphost
我知道设置allowUnlisted为真有效地完成了我的基本目标。 我只想在IIS中清理干净的东西。
C:\Windows\System32\inetsrv\appcmd.exe clear config "ParentSite/ChildSite" /section:system.webServer/security/ipSecurity /commit:apphost C:\Windows\System32\inetsrv\appcmd.exe set config "ParentSite/ChildSite" /section:system.webServer/security/ipSecurity /allowUnlisted:true /commit:apphost
有一个额外的参数(“删除”),您可以添加到“清除”命令强制IIS删除该部分以及清除它的内容;
C:\Windows\System32\inetsrv\appcmd.exe clear config "ParentSite/ChildSite" /delete:true /section:system.webServer/security/ipSecurity /commit:apphost
我已经在服务器2012 R2 / IIS 8.5上testing过了,但是它也存在于至less和服务器2008 R2 IIS 7.5一样低的版本中