title: powershell better way to test if both directories exists or one only on all pc's from domain and output to csv
body: <p>could you please help me to correct this script (gathered by pieces from internet) or better change logic how it should work (not working currently). The goal is to get pc's where only one folder exist (oracle11) and not both (11+12) and export it to csv. Oracle is a real pain in the ....
  Thank you in advance for your advice.</p>
  <pre><code>Import-Module ActiveDirectory
  $computers = Get-ADComputer -Filter * -Properties * | Select -Property Name
  $output = @()
  
  #$computers = get-adcomputer -filter * | Select-Object -Expand Name | foreach-object {
  
  Foreach ($Computer in $computers){
    if ( (test-path &quot;\\$Computer\C$\oracle\product\11.2.0\&quot; ) -and !( test-path &quot;\\$Computer\C$\oracle\product\12.2.0&quot; )) {
      $output += $Computer
    }
  } 
  $output | Export-Csv -NoTypeInformation -Path c:\temp\test.csv
  </code></pre>