Thursday, September 26, 2013

Bootable Windows Server 2012 ISO

Back in the Windows F^HVista/7 and Server 2008/2008R2 days, it was possible to install an operating system instance without needing to input a key during the installation process.  You could use various methods to make a bootable OS Install USB key then simply remove the \sources\ei.cfg file and you'd be able to choose between all the versions of the OS inside the boot.wim file - this was very handy!

Microsoft has made a change since Windows Server 2012/Windows 8 whereby they don't allow you to install Windows without the use of a Product Key.  There is no ei.cfg file in the \sources folder and you are forced to input a Product Key during installation.

Well, there's a simple way to work around this to not only create a bootable USB Key that doesn't need a Product Key during install (and lets you choose among the multiple OS variants in the boot.wim file), but also to re-create a bootable ISO image so that you can then mount this as an installation media source in Hyper-V!

The steps to achieve these goals are:
  • First, you'll need to download a Windows Server 2012 or Windows Server 2012 R2 ISO image or use the VL ISO image you already have there.  Then you'll need to either extract this image to a folder, or better still, just run the Windows 7 USB/DVD Download Tool as detailed in this post and make yourself a bootable USB key that allows for quite quick OS installs.
  • Now, you'll need to copy the following into a new file called ei.cfg in the \sources folder of the USB key:
    [Channel]
    Retail
    [VL]
    1
  • If you only need the bootable USB key, you can stop here, however if you now wish to recreate the ISO image file so that you can then use this modified image in a Hyper-V environment...
  • Download and install the Windows Assessment and Deployment Kit (ADK) for Windows 8 (yes, all 3GB of it!) to give you access to both the Deployment and Imaging Tools, which you will need to install (the other components of the WDK are optional)
  • Now, to create an ISO image that will work with BIOS-based systems, assuming the USB Key we just made is available at U: and you're creating the ISO image on D:
    • Run the Deployment and Imaging Tools Environment (Command Prompt) as Administrator, change to the "amd64\oscdimg" folder and then type the following:
    • oscdimg.exe –l<disc_label> -m -u2 –b<path_of_bootable_img_file> <path_of_installation_source> <path_where_ISO_is_to_be_created>
    • Please see this link for an explanation of the oscdimg.exe command-line options
    • Example:
      oscdimg.exe -l2K12R2BIOS -m -u2 -b"U:\boot\etfsboot.com" "U:\" "D:\2K12R2-BIOS.iso"
  • If you wish to create an ISO image that will work on both BIOS-based and UEFI-based systems such as a Hyper-V 2012 R2 Gen 2 guest instance, assuming the USB Key we just made is available at U: and you're creating the ISO image on D: (this uses a modified version of the instructions found here):
    • Run the Deployment and Imaging Tools Environment (Command Prompt) as Administrator, change to the "..\Windows Preinstallation Environment" folder
    • Type copype.cmd amd64 winpe_x64 This command creates the directory structure and copies the required files.
    • Now, copy winpe_x64/fwfiles/efisys.bin U:\boot to keep a copy on the USB key
    • Change back to the "..\Deployment Tools\amd64\oscdimg" folder, then type oscdimg -m -o -u2 -udfver102 -bootdata:2#p0,e,b"U:\boot\etfsboot.com"#pEF,e,b"U:\boot\efisys.bin" "U:\" "D:\2K12R2-UEFI.iso"
    • Update: I have thought this through a little more and found an even easier way to achieve this. :)
    • Run the Deployment and Imaging Tools Environment (Command Prompt) as Administrator, change to the "amd64\oscdimg" folder and then type the following:
    • oscdimg -l2K12R2UEFI -m -o -u2 -udfver102 -bootdata:2#p0,e,b"U:\boot\etfsboot.com"#pEF,e,b"U:\efi\microsoft\boot\efisys.bin" "U:\" "D:\2K12R2-UEFI.iso"
    • Please see the original post (here) for more information on the command-line options used.
  • Now, you can burn this ISO image to a DVD or simply use it as the source for a Hyper-V guest and because it contains both the BIOS and UEFI boot data, it can be used to install either a Gen 1 (BIOS) or Gen 2 (UEFI) Hyper-V Guest. :)

Enjoy!


Regards,

The Outspoken Wookie

2 comments:

Hilton Travis said...

I have updated the process and made it easier as well. No need to install the Windows PE component of the ADK any more - the UEFI boot code is already available to us! :)

Hilton Travis said...

If, when running the ISO build, you get an error due to the "System Volume Information" folder on the USB key you created, head over to http://www.freenew.net/windows/iobit-unlocker-1-0/68837.htm and download, install and use IObit Unlocker to unlock and delete this folder from the USB key. :)