通过PowerShell删除Ip和域限制

时间:2015-09-01 11:57:54

标签: windows powershell iis windows-server-2012

我可以通过powershell在IIS IP和域限制列表中添加IP,但无法从那里删除IP。

示例:

  

add-WebConfiguration /system.webserver/security/ipsecurity -Location“iis:\ default web site”-Value @ {ipaddress =“192.168.1.1”; allowed =“true”}

如何通过powershell

从中删除相同的ip

3 个答案:

答案 0 :(得分:1)

我需要相同的,这是有效的:

Remove-WebConfigurationProperty /system.webServer/security/ipSecurity -location "iis:\default web site" -Name "." -AtElement @{ipAddress="192.168.1.1";allowed="true"} -PSPath IIS:\

答案 1 :(得分:0)

您可以指定allowed = false,以有效关闭此规则。

add-WebConfiguration /system.webserver/security/ipsecurity -Locat "iis:\default web site" `
   -Value @{ipaddress="192.168.1.1";allowed="false"}

答案 2 :(得分:0)

Remove-WebConfiguration -Filter 'system.webserver/security/ipsecurity'-PSPath "iis:\" -Location "default website" -AtElement @{ipaddress="192.168.1.1";allowed="false";}

那为我做到了(当然位置和地址也不同)