I am trying to execute the following powershell script from a Remote machine. It is working fine when running the script locally.
I am able to see the notepad
, when I execute it from remote machine, I am not able to see any notepad.exe
process in Task Manager.
OpenNotepad.ps1:
Start-Process notepad.exe
if($?)
{
write-host "SUCCESS"
}
else
{
write-host "FAIL"
}
My Remote Script
Invoke-Command -Session $session -command "C:\Users\username\Desktop\OpenNotepad.PS1"