Running a program in Guest via Command line no longer working

Discussions about using Windows guests in VirtualBox.
Post Reply
Maddis
Posts: 4
Joined: 19. May 2023, 23:17

Running a program in Guest via Command line no longer working

Post by Maddis »

Hi All,

My first post on here. Hope someone can help. I am trying to launch a program on a guest VM (Windows 10) via command line from my host computer (Windows 11)

For some reason, only calculator works:

Code: Select all

VBoxManage --nologo guestcontrol "Joe Blogs" run --exe cmd.exe /c calc.exe --username "joebl" --password "password"
If I run the following, command prompt freezes:

Code: Select all

VBoxManage --nologo guestcontrol "Joe Blogs" run --exe cmd.exe /c notepad.exe --username "joebl" --password "password"
Same goes with any other program if I give it's full exe path.

I have tried using PowerShell too:

This works
VBoxManage --nologo guestcontrol "Joe Blogs" run --exe cmd.exe /c "powershell.exe Start-Process 'calc.exe'" --username "joebl" --password "password"
But this doesn't work:
VBoxManage --nologo guestcontrol "Joe Blogs" run --exe cmd.exe /c "powershell.exe Start-Process 'taskmgr.exe'" --username "joebl" --password "password"
I get the error:
Start-Process : This command cannot be run due to the error: This operation requires an interactive window station
If anyone has had this issue and have found a solution, please let me know :)

Kind regards,
Maddis
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Running a program in Guest via Command line no longer working

Post by mpack »

Please provide a VM log file. Make sure the VM is fully shut down, then right click it in the manager UI. Select "Show Log" and save "VBox.log" (no other file) to a zip file. Attach the zip here.
Maddis
Posts: 4
Joined: 19. May 2023, 23:17

Re: Running a program in Guest via Command line no longer working

Post by Maddis »

Sure, here is the log you requested. I have tried to restart the VM and the problem persists
Attachments
vBox Log.zip
(39.66 KiB) Downloaded 26 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Running a program in Guest via Command line no longer working

Post by scottgus1 »

Please clarify something:
Running a program in Guest via Command line no longer working
Does this in the topic title mean that your tests did work before? If so, what changed between then and now? Host OS update? Virtualbox version change? New host?
Newnick
Posts: 1
Joined: 26. May 2023, 22:11

Re: Running a program in Guest via Command line no longer working

Post by Newnick »

Maddis wrote: I get the error:
Start-Process : This command cannot be run due to the error: This operation requires an interactive window station
That error is coming from Power Shell, so it would seem that VirtualBox is running the command as you expect, but it appears to be doing so in a headless manner and/or the session it is being run in isn't session 0.
Maddis
Posts: 4
Joined: 19. May 2023, 23:17

Re: Running a program in Guest via Command line no longer working

Post by Maddis »

scottgus1 wrote: 23. May 2023, 14:19 Please clarify something:
Running a program in Guest via Command line no longer working
Does this in the topic title mean that your tests did work before? If so, what changed between then and now? Host OS update? Virtualbox version change? New host?
Sorry for the late reply. Yes it was working a few months back but now I can't seem to fix the issue or come to a solution. It's really bugging me. I have written a network relay chat where each gust can communicate with the host, but I would prefer to solve the issue, as its a much cleaner approach to just use command line.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Running a program in Guest via Command line no longer working

Post by scottgus1 »

Maddis wrote: 15. Jun 2023, 15:12 Yes it was working a few months back
Thanks for the clarification.
scottgus1 wrote: 23. May 2023, 14:19 what changed between then and now? Host OS update? Virtualbox version change? New host?
rami
Posts: 10
Joined: 8. Jul 2012, 20:53

Re: Running a program in Guest via Command line no longer working

Post by rami »

I think this may be related to the following:
viewtopic.php?t=108881
https://www.virtualbox.org/ticket/21417
rami
Posts: 10
Joined: 8. Jul 2012, 20:53

Re: Running a program in Guest via Command line no longer working

Post by rami »

As a work-around, you may want to try using PsExec.exe.

For example,

Code: Select all

PsExec.exe -i notepad.exe
rami
Posts: 10
Joined: 8. Jul 2012, 20:53

Re: Running a program in Guest via Command line no longer working

Post by rami »

As another work-around, you may want to downgrade to VirtualBox 6.1
pentagonik
Oracle Corporation
Posts: 283
Joined: 19. May 2008, 16:09
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Too many to specify!
Contact:

Re: Running a program in Guest via Command line no longer working

Post by pentagonik »

We've identified and (hopefully) fixed the issue; the reason was that the service on the guest did not start guest processes in session >= 1 anymore.

The issue should be fixed with the latest 7.0 test build for the Guest Additions (build >= 161506), which can be found here:
https://www.virtualbox.org/download/tes ... 161506.iso

After the installation the guest needs to be rebooted.

Please let us know if this fixed the issue for you. Thanks!
Post Reply