VBoxManage guestcontrol issues

Discussions about using Windows guests in VirtualBox.
Post Reply
Captain_Planet
Posts: 9
Joined: 10. Jul 2014, 14:54

VBoxManage guestcontrol issues

Post by Captain_Planet »

Hi.

I'm having a nightmare trying to get the guestcontrol command to work. I'm using a Windows 7 x64 host and a Windows 7 X64 VM. I've upgraded to the latest Guest Additions to see if that helps (4.3.12) but it doesn't.

Please see my example command below:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol win764appv64sp1 exec --image "C:\WINDOWS\system32\cmd.exe" --username admin --password "password" --wait-exit -- "\\VBOXSVR\share\install.cmd"

I have mapped a share to my host (called 'share') and can access it fine from the VM. Incidentally I've also moved the .cmd file to a local drive on the VM, and it still doesn't work.

The CMD.exe process launches, but can only be seen in Task Manager. I cannot see the black window.

Any advice appreciated.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBoxManage guestcontrol issues

Post by socratis »

The environment for the command line is NOT the same as the environment that you have as your user. So do not expect network shares and things like that to work the same as in your typical "user".
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Captain_Planet
Posts: 9
Joined: 10. Jul 2014, 14:54

Re: VBoxManage guestcontrol issues

Post by Captain_Planet »

Ok, slightly confused, but I think I know what you're getting at....

I sorted the 'not being able to see the command prompt' by using "cmd.exe /c start ...." like so:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol win764appv64sp1 exec --image "C:\WINDOWS\system32\cmd.exe" --username "admin" --password "password" --wait-exit -- "/c start copy \\VBOXSVR\share\custom.ps1 C:\"

However, as you mentioned, when this script runs just after login (I'm copying a file on a share to the root of C:\) it cannot locate the file on the share! However, if I physically navigate to the share on the VM (just browse to it), then run the command again, it works fine??

Please can you advise how I can run a script - located on my host - in the virtual session?
Last edited by Captain_Planet on 11. Jul 2014, 10:15, edited 1 time in total.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBoxManage guestcontrol issues

Post by socratis »

Take a look at the following thread, where I believe this problem has already been answered: [SOLVED] guestcontrol + Perl + shared folder == fail.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Captain_Planet
Posts: 9
Joined: 10. Jul 2014, 14:54

Re: VBoxManage guestcontrol issues

Post by Captain_Planet »

Hi. Doesn't that post just relate to Perl?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBoxManage guestcontrol issues

Post by socratis »

No, it doesn't. Don't let the title mislead you. Read it again carefully from the 5th post onward and specially the last post. It's the environment variables that were not set correctly, which caused the guestcontrol to fail.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Captain_Planet
Posts: 9
Joined: 10. Jul 2014, 14:54

Re: VBoxManage guestcontrol issues

Post by Captain_Planet »

Ok I'll read it again....

In the interim, I think another fix may be creating the share in the actual session as opposed to manually creating it. So I've added these lines to the start of my script and it appears to work ok now:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" sharedfolder remove win764appv64sp1 -name "myshare"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" sharedfolder add win764appv64sp1 -name "myshare" --hostpath "C:\test" --automount

Out of interest (and slightly off topic), when I launch my GUI is there a way to disable it? So users can just see what's happening and not actually click anything?
Post Reply