Skip to content

Instantly share code, notes, and snippets.

@ifrahim
Created February 26, 2014 15:34
Show Gist options
  • Save ifrahim/9231734 to your computer and use it in GitHub Desktop.
Save ifrahim/9231734 to your computer and use it in GitHub Desktop.
IP Restrict an IIS website using Powershell
# Restrict IIS website to be only accessible locally.
$SiteName = "MySiteName"
# secure site - Restrict IP
Set-WebConfigurationProperty -Filter /system.webserver/security/ipsecurity -Name allowUnlisted -Value $false -Location $SiteName
add-webconfiguration /system.webServer/security/ipSecurity -location $SiteName -value @{ipAddress="localhost";allowed="true"} -pspath IIS:\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment