title: Powershell: Null Array Exception in passing args to Remote Session
body: <p>I am trying to run a command on a remote session but I am getting a </p>
  
  <blockquote>
    <p>Cannot index into a null array.
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : NullArray
        + PSComputerName        : serverName</p>
  </blockquote>
  
  <p>I have checked all the arguments that I am passing to the remote session and none of them are  null. Following is the command:</p>
  
  <pre><code>Invoke-Command -Session $session -ScriptBlock {Start-Process $args[0] -ArgumentList $args[1] -RedirectStandardOutput $args[2] -RedirectStandardError $agrs[3]} -Args $Consoledir,$arguments,$stdOutLog,$stdErrLog;
  </code></pre>
  
  <p>I am using this command to run a console application that is passed in the $dir argument (D:\Temp\console.exe). This application further takes some arguments that are passed in the $arguments parameter.</p>