Reputation: 147
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
Upvotes: 1
Views: 2872
Reputation: 1
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)
Upvotes: 0
Reputation: 141
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:\
Upvotes: 1
Reputation: 13537
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"}
Upvotes: 0