1
votes

I am able to add IP in the IIS IP and domain restriction list through powershell, but cant able to remove the IP from there.

example:

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

How can I remove the same ip from there through powershell

3

3 Answers

1
votes

I needed the same and this is working:

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

You could specify allowed = false, to effectively shut down this same rule.

add-WebConfiguration /system.webserver/security/ipsecurity -Locat "iis:\default web site" `
   -Value @{ipaddress="192.168.1.1";allowed="false"}
0
votes
Remove-WebConfiguration -Filter 'system.webserver/security/ipsecurity'-PSPath "iis:\" -Location "default website" -AtElement @{ipaddress="192.168.1.1";allowed="false";}

That did it for me (with a different location and address of course)