title: Powershell empty folder with get-childitem invoked by Invoke-Command if path is in a variable
body: <p>when a form is shown,
  I try to get the files in a folder of a remote server passing a variable.
  This gives me an empty object. But if instead of a variable I pass
  a string with the path to my folder I get the correct files.</p>
  <pre><code>$form.Add_Shown({
  $fold = 'c:/mypath/test';
  
  #this returns no file
  $files = Invoke-Command -Credential $cred -ComputerName $server   -ScriptBlock {Get-ChildItem -Path $fold } ;
  
  #this code correctly returns the files present in the folder 
  #$files = Invoke-Command -Credential $cred -ComputerName $server   -ScriptBlock {Get-ChildItem -#Path 'c:/mypath/test'} ;
  
  $txt.Text=&quot;files $files&quot;;
  
  
  })
  </code></pre>
  <p>what could be the problem?</p>