<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.joescove.com/index.php?action=history&amp;feed=atom&amp;title=Virtualbox_Command_Line_Utility</id>
	<title>Virtualbox Command Line Utility - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.joescove.com/index.php?action=history&amp;feed=atom&amp;title=Virtualbox_Command_Line_Utility"/>
	<link rel="alternate" type="text/html" href="http://wiki.joescove.com/index.php?title=Virtualbox_Command_Line_Utility&amp;action=history"/>
	<updated>2026-11-15T00:12:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>http://wiki.joescove.com/index.php?title=Virtualbox_Command_Line_Utility&amp;diff=124&amp;oldid=prev</id>
		<title>Joe: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://wiki.joescove.com/index.php?title=Virtualbox_Command_Line_Utility&amp;diff=124&amp;oldid=prev"/>
		<updated>2020-12-06T22:59:48Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:59, 6 December 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Joe</name></author>
	</entry>
	<entry>
		<id>http://wiki.joescove.com/index.php?title=Virtualbox_Command_Line_Utility&amp;diff=123&amp;oldid=prev</id>
		<title>Joe at 07:20, 6 April 2010</title>
		<link rel="alternate" type="text/html" href="http://wiki.joescove.com/index.php?title=Virtualbox_Command_Line_Utility&amp;diff=123&amp;oldid=prev"/>
		<updated>2010-04-06T07:20:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The following [[:category:bash|Bash]] script was created to make controlling [http://virtualbox.org Virtualbox] from the command line a little easier.&lt;br /&gt;
&lt;br /&gt;
This script was created while using Virtualbox 3.1.6&amp;lt;br /&amp;gt;&lt;br /&gt;
Tested on:&lt;br /&gt;
* Virtualbox 3.1.6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{toc}}&lt;br /&gt;
&lt;br /&gt;
== Configure ==&lt;br /&gt;
&lt;br /&gt;
The script itself has one config setting: &amp;lt;b&amp;gt;'viewYNinMenu'&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
After any/all option menus are displayed, you can have a second question asked: &amp;lt;code&amp;gt;&amp;quot;You choose '$this' (y/n)?&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Setting &amp;lt;b&amp;gt;'viewYNinMenu'&amp;lt;/b&amp;gt; to 1 will enable this second question, setting &amp;lt;b&amp;gt;'viewYNinMenu'&amp;lt;/b&amp;gt; to 0 the second question will not be asked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Main Menu Options ==&lt;br /&gt;
[[File:Vbox utily mainmenu.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Create New vm Guest ===&lt;br /&gt;
Function called &amp;lt;code&amp;gt;createNewVM()&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be asked a few questions&lt;br /&gt;
* New guest name&lt;br /&gt;
* Menu: What OS (choices from &amp;lt;code&amp;gt;VBoxManage list ostypes&amp;lt;/code&amp;gt;)&lt;br /&gt;
[[File:Vbox utily select os.jpg]]&lt;br /&gt;
* Path to .iso&lt;br /&gt;
* Memory Size&lt;br /&gt;
* Harddrive Size&lt;br /&gt;
* .vdi file name (or file name and path if you want to store the .vdi file else where) Default: ~/.VirtualBox/HardDisks/&lt;br /&gt;
* The variables at the top of the &amp;lt;code&amp;gt;createNewVM()&amp;lt;/code&amp;gt; functon will be used for the rest of the options &amp;lt;br /&amp;gt;boot1, boot2, clipboard, acpi, ioapic, pae, nestedpaging, cpus, synthcpu, hwvirtex, vtxvpid, snapshotfolder, vram, accelerate3d, accelerate2dvideo, vrdp, vrdpport, vrdpauthtype, vrdpmulticon, storagectl, storagect2, floppy, usb, usbehci, audio, audiocontroller, nic1, nictype1, cableconnected1&lt;br /&gt;
&lt;br /&gt;
After the questions are asked, the script will display your answers with a final prompt to create. Then you will be asked if you want to Start the guest (in &amp;quot;Headless&amp;quot; mode) &amp;lt;code&amp;gt;VBoxHeadless -startvm [name]&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DELETE Guest ===&lt;br /&gt;
............&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Power Management ===&lt;br /&gt;
Uses &amp;lt;code&amp;gt;selectPowerManagement()&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Questions asked:&lt;br /&gt;
* Menu: What guest to work with&lt;br /&gt;
* Menu: Power Options&lt;br /&gt;
[[File:Vbox_utily_powermangmant.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Add DVD iso ===&lt;br /&gt;
..............&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Add shared folder ===&lt;br /&gt;
Calls &amp;lt;code&amp;gt;workWithShareFolders()&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Lets you add a new Shared Folder to a guest.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Questions asked:&lt;br /&gt;
* Menu: What guest to work with&lt;br /&gt;
* Host path to Shared folder&lt;br /&gt;
* Share folder name&lt;br /&gt;
* readonly&lt;br /&gt;
* transient&lt;br /&gt;
* Then the final &amp;quot;do you want to do this (y/n)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New shared folders can only be added to guests which are not running.&amp;lt;br /&amp;gt;&lt;br /&gt;
If the guest is running you will be prompted:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Vbox_utily_sharedfolder.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Add storage (harddrive) ===&lt;br /&gt;
...........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Remove DVD iso ===&lt;br /&gt;
...............&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Remove shared folder ===&lt;br /&gt;
Calls &amp;lt;code&amp;gt;workWithShareFolders()&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Lets you remove a Shared Folder from a guest.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Questions asked:&lt;br /&gt;
* Menu: What guest to work with&lt;br /&gt;
* Menu: Listing the names of the current shared folders&lt;br /&gt;
* transient&lt;br /&gt;
* Then the final &amp;quot;do you want to do this (y/n)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Just like adding a new Shared Folder, guest must be off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Remove storage (harddrive) ===&lt;br /&gt;
...........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Select Guest and showvminfo ===&lt;br /&gt;
Calls &amp;lt;code&amp;gt;askWhatVM_thenDisplayInfo()&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;askWhatVM_thenDisplayInfo &amp;quot;Select guest to view&amp;quot; 1&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Display &amp;quot;VBoxManage list&amp;quot; options ===&lt;br /&gt;
Displays menu for &amp;lt;code&amp;gt;VBoxManage list&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
This can be edited in the &amp;lt;code&amp;gt;displayVBoxManageList()&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Vbox utily vboxmanage list.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Command line ===&lt;br /&gt;
Lets you work with the terminal command line with-out exiting the script&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
=== startUpQuestions() ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== askWhatVM_thenDisplayInfo() ===&lt;br /&gt;
This function will:&lt;br /&gt;
# Create a Menu parsing &amp;lt;code&amp;gt;VBoxManage list vms&amp;lt;/code&amp;gt; out-put and displaying the names of the Guests installed on the host.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:VboxUtily select guest.jpg]]&lt;br /&gt;
# &amp;quot;Returns&amp;quot; some information&lt;br /&gt;
# Display &amp;lt;code&amp;gt;VBoxManage showvminfo [vmaname]&amp;lt;/code&amp;gt; if argument is passed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Arguments passed into function:&lt;br /&gt;
* Question (string)&amp;lt;br /&amp;gt;This function can be called for different reasons so we pass the &amp;quot;question&amp;quot; to it&lt;br /&gt;
* Display &amp;lt;code&amp;gt;VBoxManage showvminfo [vmaname]&amp;lt;/code&amp;gt; (int)&amp;lt;br /&amp;gt;Thought an option to display the Guest info would be nice.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Returns an &amp;quot;Array&amp;quot;&lt;br /&gt;
* arr[0] = Name&lt;br /&gt;
* arr[1] = UUID&lt;br /&gt;
* arr[2] = 1st Controller&lt;br /&gt;
* arr[3] = 2nd Controller&lt;br /&gt;
* arr[4] = Shared folders&lt;br /&gt;
* arr[5] = State (running, saved, off, etc.)&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# mock-up&lt;br /&gt;
# Just ask question and get results with out displaying 'VBoxManage showvminfo'&lt;br /&gt;
tmpArr=( $(askWhatVM_thenDisplayInfo &amp;quot;Add iso to DVD for ?&amp;quot;) )&lt;br /&gt;
vmGuestName=&amp;quot;${tmpArr[0]}&amp;quot;&lt;br /&gt;
vmGuestUUID=&amp;quot;${tmpArr[1]}&amp;quot;&lt;br /&gt;
......&lt;br /&gt;
......&lt;br /&gt;
VBoxManage storageattach &amp;quot;$vmGuestUUID&amp;quot;....&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
OR&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Display info from 'VBoxManage showvminfo'&lt;br /&gt;
askWhatVM_thenDisplayInfo &amp;quot;Display info for guest ?&amp;quot; 1 ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== displayVBoxManageList() ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== workWithShareFolders() ===&lt;br /&gt;
This function will first display a menu to choose what guest to work with via the &amp;lt;code&amp;gt;askWhatVM_thenDisplayInfo()&amp;lt;/code&amp;gt; function. After it gets the results from askWhatVM_thenDisplayInfo it will do a check to see what 'state' the guest is in, if guest is not in the 'powered off' state, another menu will appear where you can turn off the guest with one of the &amp;lt;code&amp;gt;VBoxManage controlvm&amp;lt;/code&amp;gt; options (''pause|resume|reset|poweroff|savestate|acpipowerbutton|acpisleepbutton''). &lt;br /&gt;
&lt;br /&gt;
After machine is turned off a list of current shared folders will be displayed and depending on why you are calling this function (adding a new Share or removing a Share) you will be asked acouple questions.&lt;br /&gt;
&lt;br /&gt;
Adding Shared Folder:&lt;br /&gt;
* Host path to Shared folder&lt;br /&gt;
* Share folder name&lt;br /&gt;
* readonly&lt;br /&gt;
* transient&lt;br /&gt;
* Then the final &amp;quot;do you want to do this (y/n)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Removing Shared Folder:&lt;br /&gt;
* A menu will appear listing the names of the current shared folders&lt;br /&gt;
* transient&lt;br /&gt;
* Then the final &amp;quot;do you want to do this (y/n)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If you select &amp;quot;no&amp;quot; to the &amp;quot;do you want to do this (y/n)&amp;quot; questions, you will be brought back to the main menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Arguments passed into function:&lt;br /&gt;
* &amp;quot;todo&amp;quot; (string) - adding or removing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== workWithDVD() ===&lt;br /&gt;
Calls &amp;lt;code&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments passed into function:&lt;br /&gt;
* &amp;quot;Question&amp;quot; (string)&lt;br /&gt;
* &amp;quot;todo&amp;quot; (string)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== createNewVM() ===&lt;br /&gt;
At the top of this function you ca set a bunch of variables which will be used during the creation of a new vm guest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== choose_OSfromList() ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== askQuestion() ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== displayOptions() ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== selectPowerManagement() ===&lt;br /&gt;
Calls &amp;lt;code&amp;gt;askWhatVM_thenDisplayInfo()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;powerOffSaveState()&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== powerOffSaveState() ===&lt;br /&gt;
Calls &amp;lt;code&amp;gt;displayOptions()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;loopPowerState()&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== loopPowerState() ===&lt;br /&gt;
Arguments passed into function:&lt;br /&gt;
* vmID (string)&lt;br /&gt;
* stateOrg (string)&lt;br /&gt;
&lt;br /&gt;
When this function is called it will loop &amp;lt;code&amp;gt;VBoxManage showvminfo [vmID]&amp;lt;/code&amp;gt;, grab the current 'state' of the guest and compare that to the passed 'stateOrg'. When the current state is different then the passed 'stateOrg' it will break the loop.&lt;br /&gt;
&lt;br /&gt;
This is used mainly for shutting down a machine with &amp;lt;code&amp;gt;VBoxManage controlvm [name] acpipowerbutton&amp;lt;/code&amp;gt; during changes to a guest which require the guest to be turned off. Since it takes alittle while for a guest to shut down, this loop let you know when the guest is off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Thanks to ==&lt;br /&gt;
'''[http://ubuntuforums.org/member.php?u=243323 geirha]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Roughly a year ago i made the switch to Ubuntu (from Windows). Through that time I've been learning Bash when time permits and for this &amp;quot;project&amp;quot;, geirha has been a great help and has taught me so much. Thank you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The script ==&lt;br /&gt;
{{:Virtualbox_Command_Line_Utility/1.0.0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:VirtualBox]]&lt;/div&gt;</summary>
		<author><name>Joe</name></author>
	</entry>
</feed>