Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to extract the text from a Microsoft.IIs.PowerShell.Framework.ConfigurationElement object

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?

like image 416
toryan Avatar asked Feb 14 '12 17:02

toryan


1 Answers

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
like image 97
Andy Arismendi Avatar answered Nov 15 '22 01:11

Andy Arismendi