Skip to content

Instantly share code, notes, and snippets.

@Rugby-Ball
Last active August 4, 2021 14:42
Show Gist options
  • Select an option

  • Save Rugby-Ball/2b2aed7e619a33ae027138ac25b691dd to your computer and use it in GitHub Desktop.

Select an option

Save Rugby-Ball/2b2aed7e619a33ae027138ac25b691dd to your computer and use it in GitHub Desktop.
Formats the IIS Website bindings to a more human readable format. #Inventory #WebServer #IIS
#web-binding-formated.ps1
#Formats the IIS Website bindings to a more human readable format.
Get-WebBinding | ForEach-Object {
$name = $_.ItemXPath -replace '(?:.*?)name=''([^'']*)(?:.*)', '$1'
$Server = $env:COMPUTERNAME
New-Object psobject -Property @{
Server = $server
Name = $name
Protocol = $_.protocol
Port = $_.bindinginformation.Split(":")[-2]
SSLFlag = $_.sslFlags
Binding = $_.bindinginformation.Split(":")[-1]
#Cert_Hash = $.certificatehash
}
} | Group-Object -Property Name |
Format-Table @{n="Server";e={$_.Group.Server -join "`n"}}, Name, @{n="Protocol";e={$_.Group.Protocol -join "`n"}}, @{n="Port";e={$_.Group.port -join "`n"}},@{n="SSL_Flag";e={$_.Group.sslflag -join "`n"}},@{n="Bindings";e={$_.Group.Binding -join "`n"}} -Wrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment