Powershell to discover IPs and host name bindings in IIS

posted 2/21/2016 5:37:54 AM by: timothy

If you ever need to figure out which IPs and host names are bound to which site…this powershell works pretty good.

#
#
# Get binding names

Get-WebBinding | % {
    $name = $_.ItemXPath -replace '(?:.*?)name=''([^'']*)(?:.*)', '$1'
    New-Object psobject -Property @{
        Name = $name
        Binding = $_.bindinginformation.Split(":")[-1]
    }
} | Group-Object -Property Name |
Format-Table Name, @{n="Bindings";e={$_.Group.Binding -join "`n"}} -Wrap
#
#
# Get binding IPs

$websites = Get-ChildItem IIS:\Sites
$websites

#
#

© 1999—2024 Timothy Lee Russell

vcard

View Timothy Russell's profile on LinkedIn

profile for Timothy Lee Russell at Stack Overflow, Q&A for professional and enthusiast programmers