我在Ubuntu 14.04上运行VirtualBox 5.0.16。我有32位版本的Windows7虚拟机。我想要做的是在客人上运行程序。首先,我尝试使用Python脚本用于此目的:在VirtualBox中的客户操作系统上运行程序
vbox = virtualbox.VirtualBox()
session = virtualbox.Session()
vm = vbox.find_machine('Windows7')
vm.launch_vm_process(session, 'gui', '').wait_for_completion()
session = vm.create_session()
time.sleep(35)
gs = session.console.guest.create_session('win7', '')
process, stdout, stderr = gs.execute('C:\\Windows\\System32\\cmd.exe', ['/C', 'tasklist'])
print stdout
机开始很好,但由于一些引发以下错误,我不能运行任何程序:
Traceback (most recent call last): File "runonguest.py", line 39, in gs = session.console.guest.create_session('win7', '') File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_ext/guest.py", line 24, in create_session raise SystemError("GuestSession failed to start") SystemError: GuestSession failed to start
我尝试使用命令行后为了在客人上运行程序。所以,我正在运行的虚拟机,并试图执行以下命令:
VBoxManage guestcontrol "Windows7" --username win7 run --exe C:\Windows\System32\cmd.exe --wait-stdout -- "C:\Windows\System32\cmd.exe" "/C" "tasklist"
但它给我带来了一个错误:
VBoxManage: error: VERR_ACCOUNT_RESTRICTED VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component GuestSessionWrap, interface IGuestSession, callee nsISupports VBoxManage: error: Context: "WaitForArray(ComSafeArrayAsInParam(aSessionWaitFlags), 30 * 1000, &enmWaitResult)" at line 938 of file VBoxManageGuestCtrl.cpp
我正在寻找可能的解决方案,但大多为旧版本的VirtualBox其中命令运行根本不存在。 如果有人知道任何可能的解决方案,这将是很好的。 谢谢。
谢谢。我甚至没有想到这个方向。现在它工作得很好。 – aGGeRReS
我没有在此刻我有这个问题:) – EugenG