If I run the command in powershell:
C:\Get-Website
it outputs
Name ID State Physical Path Bindings
---- -- ----- ------------- --------
Default Web Site 1 %SystemDrive%\inetpub\wwwroot http *:80:
net.tcp 808:*
net.pipe *
net.msmq localhost
msmq.formatname
localhost
But if I try to select just the Bindings:
C:\Get-Website | where {$_.Name -eq "Default Web Site"} | select Bindings
It returns:
bindings : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
How do I extract the contents of this object into a useful format?
The bindings property is a collection so you have to use the ExpandProperty
parameter:
Get-Website -Name "Default Web Site" | select -ExpandProperty Bindings
To drill down further:
get-website -name "Default Web Site" | select -ExpandProperty Bindings | Select -ExpandProperty Collection
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With