Friday, March 25, 2016

launcher - Launch an application in Windows from the Ubuntu desktop


I'd like a write a shell script in Ubuntu that does the following:



  1. Boot up a Windows 7 guest OS in Virtualbox, if it isn't running already.


  2. Run a shell script in Windows, where the shell script is invoked from the Ubuntu host operating system.



My goal is to create an application launcher on the Ubuntu host desktop for an application on the guest OS. For example, I could create a shortcut for Visual Studio on the Ubuntu desktop that launches Visual Studio in Windows. I've always wanted to be able to launch Windows applications directly from the Ubuntu desktop instead of waiting for Windows to start up before clicking an application shortcut.



There are some limitation from the Windows guests but to run a guest application in seamless mode from a script that can be put in a launcher we tested the following procedure:



  • Start VirtualBox Manager

  • Log in to windows with you user and password

  • Switch to seamless mode Host + L

  • In seamless mode save the machine's state


Now we can get full command line control over the virtual machine with the following commands:



  • Start the virtual machine from seamless save state


    VBoxManage startvm ""

    or (for the Qt frontend)


    VirtualBox --startvm ""

  • Run an application in the VM


    VBoxManage --nologo guestcontrol "" run --exe "C:\\full\\path\\to\\program.exe" --username windowsuser --password password --wait-stdout

  • Terminate VM in save state


    VBoxManage controlvm "Name_of_VM" savestate


Put these in a script to enjoy seamless Windows application windows on your Ubuntu desktop.


In case you have set up a passwordless Windows logon this will not work. See in the Virtual Box Manual for limitations and how to configure Windows to get it working.



Also, to use accounts without or with an empty password, the guest's group policy must be changed. To do so, open the group policy editor on the command line by typing gpedit.msc, open the key Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options and change the value of Accounts: Limit local account use of blank passwords to console logon only to Disabled.



On operating systems without the Group Policy Editor (gpedit.msc), such as Home editions of Windows, creating a DWORD at the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\limitblankpassworduse and setting it to zero will achieve the same effect, according to this answer.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...