I am using PsExec to run a PowerShell Script on a VM. I execute psexec like this
psexec \\ip -c -i -u Admin -p password PowerShell C:\Path to PowerShellscript on computer
PowerShell runs and it opens on the VM but immediately closes. It gives me this message in cmd on my computer
PowerShell.exe exited on ip with error code 1
How do I proceed to fix this so I can run the PowerShell script that is on my computer onto the VM?
I removed the -c
when I executed psexec and that seemed to make it work.