title: Convert ADSI objects to Powershell objects
body: <p>I have some code to get a list of IIS6 sites through ADSI:</p>
  
  <pre><code>([adsi]"IIS://localhost/W3SVC").psbase.children | select servercomment, serverstate | Where-Object {$_.serverstate -ne $null}
  
  servercomment                                               serverstate
  -------------                                               -----------
  {Default Web Site}                                          {4}
  {SharePoint Web Services}                                   {4}
  {SharePoint Central Administration v4}                      {4}
  {SharePoint - 80}                                           {4}
  </code></pre>
  
  <p>When I pipe it through the convertto cmdlets or out-string or looping through objects using tostring() I get something like this</p>
  
  <pre><code>#TYPE Selected.System.DirectoryServices.DirectoryEntry
  "servercomment","serverstate"
  "System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
  "System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
  "System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
  "System.DirectoryServices.PropertyValueCollection","System.DirectoryServices.PropertyValueCollection"
  </code></pre>
  
  <p>Basically I just need the list of sites (servercomment) to be treated like Powershell objects so I can export them through various means. But from my understanding these are collections in themselves and do have more properties, but when I go deeper I don't see anything that can be extracted as the name of an IIS site. Is getting this info through WMI easier or do I have to create a new Powershell object to contain these?</p>