I just wrote a batch file that I would like run as a remote server but it keeps giving me errors in PowerShell when I use Invoke-Command. The batch file runs fine. Does anybody have idea what am missing out on? Below is my PowerShell script and the error I get.
Invoke-Command -ComputerName "HEPWIN2020-10" -Scriptblock {Start-Process C:\DHCP\batfile1.bat}
The error I get is:
Invoke-Command : A positional parameter cannot be found that accepts argument ''.
At line:1 char:1
+ Invoke-Command -ComputerName "HEPWIN2012-03" -Scriptblock{Start-Proce ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeCommandCommand
-Scriptblockand the actual script block{...}- TheoC:\DHCP\batfile1.batbecause I assume this is just an example file and the real one may contain space characters. - Theo