Skip to content

Instantly share code, notes, and snippets.

@jeffrafter
Created August 11, 2011 16:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffrafter/1140017 to your computer and use it in GitHub Desktop.
Save jeffrafter/1140017 to your computer and use it in GitHub Desktop.
Setup a VirtualBox instance that allows you to test IE Locally from OSX
#!/bin/bash
# Much of this came from a few blog articles and one base script that I can't find now
# It is updated for the current VHD files (which supposedly expired on Aug 9th, 2011
# but still work.
#
# Requirements: Virtual Box installed, unrar (from homebrew is fine)
#
# If you want to remove stuff, open up Virtual Box and remove the VM and delete files.
#
# Note: once installed you generally have to re-install the driver for the network
# (see below)
BASEURL=http://download.microsoft.com/download/B/7/2/B72085AE-0F04-4C6F-9182-BF1EE90F5273
for I in 6
do
if [ ! -f ~/.VirtualBox/HardDisks/WinXPIE$I.vhd ];then
if [ ! -f ~/Downloads/Windows_XP_IE6.exe ];then
echo "Downloading image.."
curl -o ~/Downloads/Windows_XP_IE6.exe $BASEURL/Windows_XP_IE6.exe
fi
cp ~/Downloads/Windows_XP_IE6.exe ./Windows_XP_IE6.exe
unrar e -xReadMe.txt -xVPC_EULA.txt -c- -o+ ./Windows_XP_IE6.exe
mkdir -p ~/.VirtualBox/HardDisks
mv Windows\ XP.vhd ~/.VirtualBox/HardDisks/WinXPIE$I.vhd
rm ./Windows_XP_IE6.exe
rm ./Windows\ XP.vmc
fi
if [ ! -f ~/VirtualBox/VBoxGuestAdditions_3.2.0.iso ];then
echo "Downloading early guest additions with network.."
curl -o ~/VirtualBox/VBoxGuestAdditions_3.2.0.iso http://download.virtualbox.org/virtualbox/3.2.0/VBoxGuestAdditions_3.2.0.iso
fi
UUID=`VBoxManage internalcommands sethduuid ~/.VirtualBox/HardDisks/WinXPIE$I.vhd | grep UUID | awk '{print $4}'`
echo "UUID: $UUID"
[ $? == 0 ] && VBoxManage createvm --name WinXPSP3IE$I --ostype WindowsXP --register --uuid $UUID
[ $? == 0 ] && VBoxManage storagectl $UUID --name "IDE Controller" --add ide
[ $? == 0 ] && VBoxManage storageattach $UUID --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium ~/.VirtualBox/HardDisks/WinXPIE$I.vhd
[ $? == 0 ] && VBoxManage storageattach $UUID --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium ~/.VirtualBox/VBoxGuestAdditions_3.2.0.iso
[ $? == 0 ] && VBoxManage modifyvm WinXPSP3IE$I --memory 1024
[ $? == 0 ] && VBoxManage startvm WinXPSP3IE$I
# todo: This last command always time's out. probably cause it wants to pop up a tiny GUI with an Ok button..
[ $? == 0 ] && VBoxManage guestcontrol WinXPSP3IE$I execute "C:\\WINDOWS\\system32\\cmd.exe" --username User --password Password1 -- "/k D:\\VBoxWindowsAdditions-x86.exe /S /extract /D=C:\\Drivers"
done
echo "Install network from C:\Drivers\x86\Network\AMD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment