I am trying to run a PS Remote session from Machine A to access Machine B. Both are on the same domain and Kerberos authentication is working and I can establish a PS Remote session.
I am trying to run a script from Machine A on MAchine B passing parameters to that script as follows:
$build_script_dir = Resolve-Path .
$file_to_execute = "$build_script_dir\file_to_execute.ps1"
invoke-command -ComputerName MachineB -FilePath $file_to_execute -argumentlist $Arg1,$Arg2,$Arg3,$Arg4
This doesn't seem to invoke the script. I have even tried to take the script to the remote machine and then execute it that way as follows:
$remote_file = "c:\path-to-file\remote_file.ps1"
invoke-command -ComputerName MachineB -ScriptBlock {$remote_file} -argumentlist $Arg1,$Arg2,$Arg3,$Arg4
What am I missing that is stopping the script from running? I have about 10 arguments to pass to the script and the script will manipulate IIS.
Paul