Skip to content

Instantly share code, notes, and snippets.

@yangyer
Last active December 29, 2017 17:52
Show Gist options
  • Save yangyer/b1515e8a018015abff99fe0d84dbc1f7 to your computer and use it in GitHub Desktop.
Save yangyer/b1515e8a018015abff99fe0d84dbc1f7 to your computer and use it in GitHub Desktop.
Get IIS Sites Binding and Ports
Get-WebBinding | % {
$name = $_.ItemXPath -replace '(?:.*?)name=''([^'']*)(?:.*)', '$1'
New-Object psobject -Property @{
Name = $name
Binding = $_.bindinginformation.Split(":")[-1]
Port = [int]::Parse($_.bindinginformation.Split(":")[1])
}
} |
#Where-Object {$_.Name -like "Site1-*"} |
Sort-Object Port |
Out-GridView
Clear-Hosta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment