title: Execute a file remotely with powershell
body: <p>I am trying to run a batch file remotely using Invoke-Command</p>
  <pre><code>PS C:\Users\ale&gt; Invoke-Command -ComputerName SERVER -ScriptBlock { Invoke-Expression -Command:&quot;cmd.exe /c 'C:\Test\Extract.bat'&quot; }
  </code></pre>
  <p>The batch file is supposed to output 3 files in C:\Test\ and is running fine locally.
  When I execute the command above, here's the output I receive in powershell</p>
  <pre><code>NotSpecified: (:String) [], RemoteException
      + CategoryInfo          : NotSpecified: (:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
      + PSComputerName        : SERVER
   
  1_03102021.csv
  2_03102021.csv
  3_03102021.csv
  </code></pre>
  <p>As I check there was no file in the remote directory. Any advice please?</p>