08 September, 2010

Installing Windows XP Unattended with VirtualBox

If you're like me you find that you may wish to experiment with clean installations of WinXp VMs from time to time. Sometimes you wish to modify the VM settings that must be assigned prior to OS installation. Sometimes you just want a clean slate to start from. And other times you've got nothing else to do and "God help you" you just plain love installing operating systems in your spare time. Well, if any of this is true and you'd like to know how to install without baby-sitting this post is for you.

The overall intent is that you can install Xp unattended if you properly populate an answer file on a floppy disk. The installation pulls the specifications from the answer file (winnt.sif).

Step 1 – Creating a Virtual Floppy Disk
user@xion:~$ dd bs=512 count=2880 if=/dev/zero of=~/.VirtualBox/HardDisks/floppy01.img
user@xion:~$ /sbin/mkfs.msdos ~/.VirtualBox/HardDisks/floppy01.img
You may need to install dosfstools package.

http://untitledfinale.wordpress.com/2007/10/09/create-mount-and-copy-floppy-disks-images-under-linux/

Step 2 – Create the Virtual Machine
user@xion:~$ VBoxManage createvm --name AutoInstallXp --register --ostype "WindowsXP"

user@xion:~$ VBoxManage modifyvm AutoInstallXp --memory 1024 --vram 16 --boot1 dvd --boot2 floppy --boot3 disk


Step 3 – Create Hard Drive
user@xion:~$ VBoxManage createhd --filename AutoInstallXp.vdi --size 10240
user@xion:~$ VBoxManage openmedium disk AutoInstallXp.vdi

Step 4 – Attach Hard Disk
user@xion:~$ VBoxManage storagectl AutoInstallXp --add ide --name "Storage Controller"

user@xion:~$ VBoxManage storageattach AutoInstallXp --storagectl "Storage Controller" --port 0 --device 0 --type hdd --medium AutoInstallXp.vdi

user@xion:~$ VBoxManage storageattach AutoInstallXp --storagectl "Storage Controller" --port 0 --device 1 --type dvddrive --medium HardDisks/WinXpInstall.iso

Step 5 – Add Floppy Disk
user@xion:~$ VBoxManage storagectl AutoInstallXp --add floppy --name "Floppy Controller"

user@xion:~$ VBoxManage storageattach AutoInstallXp --storagectl "Floppy Controller" --port 0 --device 0 --type fdd --medium ~/.VirtualBox/HardDisks/floppy01.img

Step 6 – Populate Unattended Answer File
Copy the example answer file to the floppy image and update the ProductKey field value. This can be done by mounting the floppy image as root and copying the contents as follows:
# mount -o loop .VirtualBox/HardDisks/floppy01.img /mnt
# cp winnt.sif /mnt
# cat /tmp/winnt.sif
;SetupMgrTag
[Data]
AutoPartition=1
MsDosInitiated="0"
UnattendedInstall="Yes"
AutomaticUpdates="Yes"

[Unattended]
UnattendMode=FullUnattended
OemSkipEula=Yes
OemPreinstall=No
TargetPath=\WINDOWS
Repartition=Yes
UnattendSwitch=Yes
AutoActivate=Yes

[GuiUnattended]
AdminPassword=*
EncryptedAdminPassword=NO
OEMSkipRegional=1
TimeZone=20
OemSkipWelcome=1

[UserData]
ProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
FullName="personal"
OrgName="nona ur business"
ComputerName=WinXp

[GuiRunOnce]
; Command0=%SystemRoot%\system32\cmd.exe

[Identification]
JoinWorkgroup=WORKGROUP

[Networking]
InstallDefaultComponents=Yes

[Display]
BitsPerPel=8
XResolution=1024
YResolution=768
Flags=0
AutoConfirm=1


Step 7 – Add CDRom
user@xion:~$ dd if=/dev/sr0 of=~/.VirtualBox/HardDisks/WinXpInstall.iso
user@xion:~$ VBoxManage openmedium dvd WinXpInstall.iso
user@xion:~$ VBoxManage storageattach AutoInstallXp --storagectl "Storage Controller" --port 0 --device 1 --type dvddrive --medium HardDisks/WinXpInstall.iso

Step 8 – Start the VM
user@xion:~$ VBoxManage startvm AutoInstallXp

No comments: