Last active
August 4, 2021 14:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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