title: How to assign a split path to different columns?
body: <p>I wanted to get a file path like :
  C:\Users\username\Desktop
  and split them up in columns for an excel file ie:</p>
  
  <pre><code>Root | sub folder1| sub_folder2|subfolder3
  C:\  |Users       |    username|Desktop
  </code></pre>
  
  <p>I tried assigning them individually to different variables but some path's are longer than others</p>
  
  <p>I tried doing </p>
  
  <pre class="lang-bsh prettyprint-override"><code>
  
  $final = Invoke-Command -ComputerName $hostname -ScriptBlock {
  
      $path = 'C:\Users\Username\ Desktop'
  [PSCustomObject]@{‘Name’ = $path;'Roots' = $path -split '\\' } 
  
  }
  
  $final|Select-Object Name, Roots | Export-excel '.\testfile.xlsx' -append
  
  </code></pre>
  
  <p>I'm not getting an error but when I open the excel file, only one file shows up and the roots aren't separated into different columns</p>