title: Powershell - Win32_ComputerSystem class properties- DNSHostName
body: <p>I have a powershell script that allows me to query AD for computers based on OU.</p>
  
  <pre><code>strFilter = "computer"
  $args = "Computers" 
  
  $objDomain = New-Object System.DirectoryServices.DirectoryEntry
  
  $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
  $objSearcher.SearchRoot = "LDAP://OU= " + $args + ",DC=domain,DC=com"
  $objSearcher.SearchScope = "Subtree" 
  $objSearcher.PageSize = 1000 
  
  $objSearcher.Filter = "(objectCategory=$strFilter)"
  $colResults = $objSearcher.FindAll()
  
  foreach ($i in $colResults) 
      {
          $objComputer = $i.GetDirectoryEntry()
          Get-WMIObject Win32_ComputerSystem -computername $objComputer.Name
  
          $IPV6 = $false
          $arrInterfaces = (Get-WmiObject -class Win32_NetworkAdapterConfiguration -filter "ipenabled = TRUE").IPAddress
  
          foreach ($i in $arrInterfaces) {$IPV6 = $IPV6 -or $i.contains(":")}
  
          write-host "IPV6 Enabled:" $IPV6
          write-host `n
      }
  </code></pre>
  
  <p>It returns several entries as expected. In the following format:</p>
  
  <p>Domain              : name.com</p>
  
  <p>Manufacturer        : LENOVO</p>
  
  <p>Model               : 3134C2U</p>
  
  <p>Name                : name</p>
  
  <p>PrimaryOwnerName    : name</p>
  
  <p>TotalPhysicalMemory : 3064381440</p>
  
  <p>My question is, can I filter or format out everyting except for the "Name" property that is returned. </p>
  
  <p>I thought I could achieve this using the DNSHostName property under the Win32_ComputerSystem class but I am doing something wrong clearly. </p>