1

Fore some reason after i create new VM and install OS to it then it stops booting after the installation is completed. I have to re-mount the ISO i used for install to get the VM working normally. Virtualbox is latest version and iso is default Windows 7 SP1 x64. I create the VM trough commandline batch file:

REM Create Entry:
VBoxManage createvm -name "Windows 7 - For Testing Purposes Only" -ostype Windows7_64 --register

REM Create Drive:
VBoxManage createhd --filename "D:\Virtual Machines\7HD" --size 12288 --format VHD

REM Add Controllers:
VBoxManage storagectl "Windows 7 - For Testing Purposes Only"  --name "SATA Controller" --add sata --sataportcount 2 --hostiocache on --bootable on

REM Attach to Controllers:
VBoxManage storageattach "Windows 7 - For Testing Purposes Only" --storagectl "SATA Controller" --port 0 --type hdd --medium "D:\Virtual Machines\7HD.vhd"
VBoxManage storageattach "Windows 7 - For Testing Purposes Only" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium emptydrive

REM Set VM Parameters:
VBoxManage modifyvm "Windows 7 - For Testing Purposes Only" --memory 4096 --vram 130 --cpus 4 --accelerate3d on --boot1 dvd --boot2 none --boot3 none --boot4 none --usb on --usbehci on --audio dsound --audiocontroller hda --nic1 bridged --bridgeadapter1 "Realtek RTL8139/810x Family Fast Ethernet NIC" --bioslogodisplaytime 1 --biosbootmenu menuonly --largepages on

REM Add Shared folders from host:
VBoxManage sharedfolder add "Windows 7 - For Testing Purposes Only" --name "C_DRIVE" --hostpath C:\ --automount
VBoxManage sharedfolder add "Windows 7 - For Testing Purposes Only" --name "D_DRIVE" --hostpath D:\ --automount
VBoxManage sharedfolder add "Windows 7 - For Testing Purposes Only" --name "K_DRIVE" --hostpath K:\ --automount
VBoxManage sharedfolder add "Windows 7 - For Testing Purposes Only" --name "Q_DRIVE" --hostpath Q:\ --automount

REM Create Shortcut for the new VM on desktop:
copy NUL %temp%\CreateWVVMShortcut.vbs
echo Set Shell = CreateObject("WScript.Shell")>>%temp%\CreateWVVMShortcut.vbs
echo DesktopPath = Shell.SpecialFolders("Desktop")>>%temp%\CreateWVVMShortcut.vbs
echo Set link = Shell.CreateShortcut(DesktopPath ^& "\Windows 7 TEST.lnk")>>%temp%\CreateWVVMShortcut.vbs
echo link.Arguments = "-startvm ""Windows 7 - For Testing Purposes Only""">>%temp%\CreateWVVMShortcut.vbs
echo link.IconLocation = "%ProgramW6432%\Oracle\VirtualBox\VirtualBox.exe,0">>%temp%\CreateWVVMShortcut.vbs
echo link.TargetPath = "%ProgramW6432%\Oracle\VirtualBox\VirtualBox.exe">>%temp%\CreateWVVMShortcut.vbs
echo link.WorkingDirectory = "%ProgramW6432%\Oracle\VirtualBox">>%temp%\CreateWVVMShortcut.vbs
echo link.Save>>%temp%\CreateWVVMShortcut.vbs
cscript //nologo %temp%\CreateWVVMShortcut.vbs

REM Run new VM:
VBoxManage startvm "Windows 7 - For Testing Purposes Only" --type gui

Am i doing something wrong or is it expected behaviour that you need to have the ISO always mounted to run the VM?

2
  • Do you have the live CD/DVD checked?
    – Keltari
    Feb 8, 2013 at 1:55
  • Nope didnt have. But overall i think i know why the image was unmounted. Thats because there is one free SATA port and when i install guest additions the ISO gets unmounted and after guest additions are installed and system restarted it complains that it cant find the ISO. So my fault it seems. Perhaps i should add one more SATA port with the --emptydrive flag. Thats assuming VM Additions will be mounted to the first free port and not the port that has the boot critical ISO mounted. Also there appears to be no way to make a specific SATA controller Live CD/DVD via commandline.
    – TMRW
    Feb 8, 2013 at 8:34

1 Answer 1

1

I was able to enable "Live CD/DVD" via command-line using [--tempeject on] in the following way:

VBoxManage.exe storageattach %VM_NAME% --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --tempeject on --medium %VBOX_HOME%\VBoxGuestAdditions.iso
3
  • What exactly do you mean with I was able to turn "Live CD/DVD"? Apr 25, 2014 at 6:54
  • “Turn on”, obviously. Still, it’s not exactly an answer to the question...
    – Daniel B
    Apr 25, 2014 at 7:03
  • Intresting. I will test this when i have some more free time.
    – TMRW
    Apr 26, 2014 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .