【发布时间】:2013-02-27 23:25:48
【问题描述】:
我正在编写一个 Powershell 脚本来添加/删除/编辑使用 Powershell 的网站的 IP 限制。到目前为止,我能够添加限制,但想知道编辑现有 ip 限制的最佳方法。
添加
Add-WebConfiguration -Filter /system.webserver/security/ipsecurity -Value @{ipAddress=$ipAddress;subnetMask="255.255.255.255";allowed=$allowed} -Location $websiteName -PSPath "IIS:\"
编辑
我尝试了以下各种组合:
Set-WebConfiguration -Filter system.webServer/security/ipSecurity/add[@ipAddress='192.123.123.123'] -Name "ipAddress" -Value $ipAddress -Location $websiteName -PSPath "IIS:\"
Set-WebConfigurationProperty -Filter system.webServer/security/ipSecurity/add[@ipAddress='192.123.123.123'] -Value = @{ipAddress=$ipAddress;subnetMask="255.255.255.255";allowed=$allowed} -Location $websiteName -PSPath "IIS:\"
基本上是清除所有并重新创建的最好方法吗?
【问题讨论】:
标签: iis powershell iis-7