I created the following Powershell scripts. One to kill a process, the other to launch a process on a remote machine. Both scripts work (remotely and locally), however the launch script starts the process (I can see it in the task manager) but there’s no visible window or runs without launching a process and produces no error.
I have set the executionpolicy to bypass and tried various versions of the script but can’t seem to get it to launch any application with a window. I have also Enabled-PSRemoting.
#Kill Process
Invoke-Command –ComputerName mamba -credential administrator –ScriptBlock {Get-Process "notepad" | Stop-Process -force}
#Or
Enter-PSSession mamba get-process “notepad” | Stop-Process –force
#Start Process
Invoke-Command -ComputerName mamba -Credential administrator -scriptblock {start-process "notepad"} (runs without error but does not launch a process)
#Or
Invoke-Command -ComputerName mamba -scriptblock {start-process "notepad"} (runs without error but does not launch a process)
#Or
Enter-PSSession mamba start-process “notepad” (process launches but no window)
What am I doing wrong? Thank you ahead of time for your feedback!