title: Create excel csv files with all computers of each Listed OU
body: <pre><code>$OUpath = @(
    &quot;OU=example,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=exam.ple,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example1,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example2,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example3,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example4,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example5,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example6,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example7,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example8,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=example9,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=CA,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=CAB,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=Ara,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=Gil,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=Kbi,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=Cieux,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=liz,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=mes,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=IO,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=SE,OU=Parent OU,DC=domain name,DC=domain prefix&quot;,
    &quot;OU=SC,OU=Parent OU,DC=domain name,DC=domain prefix&quot;)
  
  foreach ($i in $OUpath){
  
  $fname= $i.Substring(3,9) + &quot;.csv&quot;
  Get-ADComputer -Filter * -Property * -SearchBase $i.toString() | 
  Select-Object Name,OperatingSystem,OperatingSystemVersion | 
  Export-CSV $fname -NoTypeInformation -Encoding UTF8
  }
  </code></pre>
  <p><strong>Remark</strong>: OU=exam.ple with $fname= $i.Substring(3,9) + &quot;.csv&quot; gives not an excel csv file because of the dot in the ou name.<br />
  <strong>Question</strong>: Is it possible to generate 1 excel file with different workSheets ? And transform the data directly into excel tables ?</p>