# remote exe execution, not working as expected

**URL:** <https://forums.powershell.org/t/remote-exe-execution-not-working-as-expected/10907>\
**Category:** PowerShell Help\
**Created:** [July 1, 2018, 7:26am UTC](https://forums.powershell.org/t/remote-exe-execution-not-working-as-expected/10907 "2018-07-01T07:26:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prabhasb](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@prabhasb](https://forums.powershell.org/u/prabhasb)\
**Post date:** [July 1, 2018, 7:26am UTC](https://forums.powershell.org/t/remote-exe-execution-not-working-as-expected/10907/1 "2018-07-01T07:26:36Z")

</div>

hi

I have a exe file on remote computer which opens a browser and run some test cases when i run it. Now, When i try to run the same exe file remotely through PowerShell script it is not working as expected and giving some wrong output. If i login to remote computer manually and run the exe file it is working as expected.

i need to open a new remote session then open a new command prompt and then run the exe, how can achieve it through PowerShell script. Below is the script i have written

$Username = ‘MYDomain\Prabha-K’  
$Password = ‘pas@123’  
$pass = ConvertTo-SecureString -AsPlainText $Password -Force  
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass  
Invoke-command -ScriptBlock { & ‘C:\nxtdr\SmokeTest.exe’ -something “AllTestCases”} -Credential $cred -Verbose -ComputerName [test01.MYDomain.com](http://test01.MYDomain.com)

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [July 1, 2018, 8:22am UTC](https://forums.powershell.org/t/remote-exe-execution-not-working-as-expected/10907/2 "2018-07-01T08:22:24Z")

</div>

Remote sessions don’t have a full user profile and can’t run anything GUI-based. That’s likely the difference.

---

<div class="post-metadata">

**Author:** ![emiltanev](https://avatars.discourse-cdn.com/v4/letter/e/5e9695/32.png) [@emiltanev](https://forums.powershell.org/u/emiltanev)\
**Post date:** [July 2, 2018, 7:48am UTC](https://forums.powershell.org/t/remote-exe-execution-not-working-as-expected/10907/3 "2018-07-02T07:48:30Z")

</div>

You could put the exe in the StartUp programs and use powershell to restart the computer.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/remote-exe-execution-not-working-as-expected/10907/4 "2024-05-16T20:34:46Z")

</div>


