Page 1 of 1

Attach cloned VDI to new VM via commandline

Posted: 11. Jan 2011, 07:26
by se000
Hello, am starting to write batch file to clone VM but can't find the way to attach vdi to new VM via VBoxManage.exe
Can someone help me with that?

Code: Select all

@echo off
echo.           Enter the USB disk name where the  VirtualBox portable is:
set /p Disk=
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe createvm --name "WinXPnew" -register
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe modifyvm WinXPnew --memory 512
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe clonehd "%Disk%:\distr\Portable-VirtualBox\data\.VirtualBox\Machines\Windows XP\Windows XP.vdi" "%Disk%:\distr\Portable-VirtualBox\data\.VirtualBox\Machines\WinXPnew\WinXPnew.vdi" 
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe internalcommands sethduuid "%Disk%:\distr\Portable-VirtualBox\data\.VirtualBox\Machines\WinXPnew\WinXPnew.vdi" 
-----here must be line with attaching vdi to Virtual Machine ---------------

Code: Select all

echo. enter the new  VirtualBox name for cloned wm:
set /p vmname=
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe modifyvm WinXPnew --name %vmname% 
%Disk%:\distr\Portable-VirtualBox\app32\VBoxManage.exe startvm %vmname%
pause

Re: Attach cloned VDI to new VM via commandline

Posted: 11. Jan 2011, 16:21
by Perryg
We do not support portable VirtualBox.