Guide: How to install Windows 10 using VHDs

Last week, we posted a quick guide on how you can create bootable media for Windows 10.

After reading a lot of the comments, we’ve added a mini guide to creating USB media, with sections on using Rufus and Microsoft's own Windows 7 USB/DVD Tool. And here, we've put together a guide on how to create, boot to and install Windows on a VHD. So without further ado, let’s crack on!

Up until now, using USB media on your desktop or laptop to install Windows 10 is a destructive process, unless you are dual booting to a secondary hard disk. But what if you don’t have a second hard disk and don’t want to have the Windows 10 installation destroy your existing Windows instance?

Those of you that work in IT will be well versed in virtualization. It’s still a buzzword, and with Windows 10 introducing Virtual Desktops, it will continue to be. The simplest, non-destructive way to test Windows 10 would be to download any number of the free Virtual Server apps out there. The most popular, free apps, would have to be VMware Player and VirtualBox. You should also know that Windows 8.1 has Hyper-V built-in in Pro and Enterprise versions.

While there are other more complex and complete solutions from VMware, Citrix and Microsoft themselves. If your computer has a half decent processor (i5 upwards), at least 6GB of RAM and 50GB of free space you’d be best installing either VMware Player or VirtualBox and start playing/learning.

We’ve already touched upon utilizing your existing hardware to install Windows 10 as a virtual machine on your host OS. But the problem with that is, you will have to take a slight performance hit (due to the Windows 10 OS sitting on the virtual stack of network, storage and hardware). What if you wanted to boot Windows 10 on your system, without formatting the hard disk? This is where VHDs (virtual hard disks) prove their worth.

We can create a VHD in Windows 7, 8 and 8.1 (not to mention Server 2008 R2 and up) and install to what is essentially a secondary hard disk, stored as a .vhd file, on your physical disk(s).

There are three ways that creating the VHD can be achieved: Computer/Disk Management Console, diskpart and PowerShell. We’ll look at all three, but first let’s start with Computer Management.

  1. Open compmgmt.msc as an administrator
    1. Click/press Start, type compmgmt.msc, right click on the (likely) first result and choose Run as administrator
  2. Once in Computer Management, right click the Disk Management and choose Create VHD

     
  3. You will be asked to specify a location for the VHD, which we’ve chosen C:\VHD and the filename Win10.vhd
    1. Set your disk size – we’ve gone with the standard 32GB
    2. Unless you’ve got space to spare, you don’t need to worry about make it a VHDX file
    3. Unless space is at a premium, choose Fixed size. This means the VHD will be 32GB in size
  4. Click OK and wait for the VHD to be created
  5. The VHD should automatically be attached, but if it’s not right click the Disk Management again, this time choosing Attach VHD
  6. Click Browse and choose the VHD to attach

     
  7. Click OK to finish
    1. As far as Windows is concerned, the VHD is a newly installed hard disk, so you don’t need to initialize and format it at all

Again, another simple process, with the lengthiest section taken up by the system creating the VHD. Time to see how the process is completed using diskpart.

  1. Open a command prompt as an administrator
    1. Click/press start, type CMD, right click on the (likely) first result and choose Run as administrator
  2. In the command prompt window, type diskpart and press enter

     
  3. Once at the diskpart command prompt, type create vdisk file=C:\VHD\Win10_2.vhd maximum=32768 type=fixed and press enter
    1. Be prepared to wait, again
  4. Type select vdisk file=C:\VHD\Win10_2.vhd and press enter
  5. Type attach vdisk and press enter

     
  6. Type exit and press return

There you have it folks, the exact same process as what was performed in Computer/Disk Management, only at the command line.

Finally, what about PowerShell? Any of you that work in IT and deal with Active Directory, Exchange, SharePoint, etc will know that Microsoft is investing heavily in moving towards a command line driven environment. That’s evident even on Windows 8, with PowerShell coming built in. However, to get the functionality of being able to manage things like Exchange or Hyper-V, you do need to turn on or install the relevant features on the management machine.


How to install the Hyper-V tools for creating VHDs with PowerShell on Windows 8/8.1

Now that you’ve done this, you can create the VHD using PowerShell.

  1. Open Windows PowerShell as an administrator
    1. Click/press start, type PowerShell, right click on the (likely) first result and choose Run as administrator
  2. Once at the command line, type New-VHD -Path C:\VHD\Win10_3.vhd -Fixed -SizeBytes 32GB

     
  3. Type the following command Mount-VHD -Path C:\VHD\Win10_3.vhd

     
  4. The disk will need initialised using Initialize-Disk -Number 2
    1. You can use the Get-Disk command to see the list of disks and their numbers
  5. Now that you know the disk number, use the following piped commands to partition, format and assign a letter to the drive: Get-Disk -Number 2 | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -Confirm:$false –Force

We’ve added a bit more detail to the PowerShell process, just to show you the ability of PowerShell compared with diskpart. However, you only need to create the VHD using the New-VHD command. And with each method, you don’t need to go as far as attaching the VHD as we do that during the Windows install process.

Now that our VHD is ready to install Windows onto, the final step is to install Windows 10. While there are methods for using the bcdedit command, it is now done for you using the Windows install process itself.

  1. Insert your Windows 10 USB media into your laptop/desktop and boot from it
  2. Move through the language/regional options, license confirmation screens and installation type screens
  3. When you get to the Where do you want to install Windows screen, press Shift+F10 to get a command prompt window
  4. Here, type diskpart

     
  5. As we’ve already created vdisk(s) in the previous processes, we simply have to add them to the list of available disks
    1. select vdisk file=D:\VHD\Win10.vhd
  6. Type attach vdisk and press enter

     
  7. Close the command prompt and refresh your list of disks

     
  8. Choose the now added-to-the-list vdisk, ignoring the message saying Windows can’t be installed on it, and click Next
  9. Sit back and wait for the OS to be installed as normal, and once complete you should see this on boot

We’ve tried to cover enough across all three guides to allow you to install Windows 7, 8/8.1 and 10 on any platform. You can even use the above methods to dual boot Windows Server 2008 R2 upwards on a laptop or desktop machine.

We do agree that most average users will never touch upon any of these processes. But seeing as Windows 10 is at the Technical Preview stage, designed for enthusiasts and IT Professionals, there's no harm in showing you the easy and the not-so-easy ways of installing an instance of Windows.

Report a problem with article
Previous Story

Microsoft registers AnarchistFashion.com and a few others too

Next Story

Xbox One or PS4: Which new-generation console should I buy?

8 Comments - Add comment

Advertisement