Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
16
rated 0 times [  16] [ 0]  / answers: 1 / hits: 19119  / 2 Years ago, tue, september 6, 2022, 1:04:57

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.


More From » windows

 Answers
5

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 "<Name_of_VM>"


    or (for the Qt frontend)



    VirtualBox --startvm "<Name_of_VM>"

  • Run an application in the VM



    VBoxManage --nologo guestcontrol "<Name_of_VM>" run --exe "C:fullpathtoprogram.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 ConfigurationWindows SettingsSecurity SettingsLocal PoliciesSecurity 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_MACHINESYSTEMCurrentControlSetControlLsalimitblankpassworduse and setting it to zero will achieve the same effect, according to this answer.


[#37415] Wednesday, September 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fulerio

Total Points: 172
Total Questions: 124
Total Answers: 109

Location: Hungary
Member since Thu, Aug 6, 2020
4 Years ago
;