Jegan.M
Jegan.M

Reputation: 147

Remove Ip From Ip and domain restriction through powershell

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

Answers (3)

dthang
dthang

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

Milton Carranza
Milton Carranza

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

FoxDeploy
FoxDeploy

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

Related Questions