Useful Tools for Hyper-V Administrators

Microsoft recently updated two tools that are useful for IT pros who are deploying Hyper-V: Convert-WindowsImage and Disk2vhd. These updates include support for Windows Server 2012 R2 and Windows 8.1.

Tools for Hyper-V Admins

Convert-WindowsImage 6.3

The Convert-WindowsImage.PS1 script is a free download from the TechNet Script Center gallery. Convert-WindowsImage has been around since the preview releases of Windows 8 and Windows Server 2012, replacing WIM2VHD. You can use this tool to create a virtual hard disk (VHD or VHDX formats) for a virtual machine from the installation media (ISO file) of Windows. For example, say you have downloaded Windows Server 2012 R2 and you’d like to quickly deploy a generalized (Sysprep) virtual machine as quickly as possible. Fire up Convert-WindowsImage, create a new VHDX, and attach it to a virtual machine. Boot up the virtual machine, answer the mini-setup wizard questions, and you have your WS2012 machine up and running.

Convert-WindowsImage is easy to use. You can run the tool completely from the PowerShell prompt (enable the execution of scripts first with either Set-ExecutionPolicy or Active Directory Group Policy); all the instructions can be found on the download page. That option might be useful for regular VM builds from the original Microsoft media (should be rare for most of us because we should use VM templates). Alternatively you can run the tool with the –ShowUI flag to open up a graphical interface and supply all the information there. This approach is much easier, and probably useful for those of us who only create a new virtual machine template whenever Microsoft releases new Windows media.


Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts. Our next episode, “Polaris Inc., and Microsoft Teams- Reinventing how we work and play” will be airing on Oct. 28th from 10-11am PST.

Creating a VHDX directly from Windows media.

Using Convert-WindowsImage as above will install Windows Server 2012 R2 Datacenter into a new VHDX file. The Windows installation will be generalized as if you had run Sysprep. Note that you could create a VHD file (not that you should, unless you plan to upload the virtual machine to Azure or migrate it to a legacy version of Hyper-V), include an unattended answer file to automatically deal with the mini-setup wizard questions (and more), name the resulting VHDX file, and configure the working directory. You should also be aware that the tool can use a WIM file (such as install.wim as found in the Windows installation media) and that it can query for the possible images within your ISO or WIM file (I chose the full installation of the Datacenter edition).

Version 6.3 of Convert-WindowsImage adds support for creating GPT disks that are used by UEFI based machines. And that allows you to create a virtual hard disk that can be used by Generation 2 virtual machines.

I really like this tool. It might not be supported by Microsoft, but it gives me the quickest way to deploy a new VHD/X file that I can use for:

  • Bare metal host deployment: The resulting file can be used by System Center Virtual Machine Manager to deploy Hyper-V hosts to bare metal servers.
  • Virtual machine templates: A new virtual machine can be quickly deployed, manually updated, and recaptured as a template.


Disk2vhd V2.0

Another free tool, released under the Sysinternals banner (of Mark Russinovich fame), Disk2vhd gives you a free solution for converting physical disks into virtual hard disks. This is pretty important because – for some reason – Microsoft chose to remove the P2V (physical to virtual) conversion functionality from System Center Virtual Machine Manager 2012 R2. That leaves us with just Disk2VHD as the only Microsoft-provided option.

Disk2VHD is easy to use. Download and extract the zip file before running the executable file on the physical server that you want to capture. By default it will create a VHDX file (new in this version). Application consistency is maintained by creating the virtual hard disk from a Volume Shadow Copy Service (VSS) snapshot. Note that any changes to the capture physical disk(s) after this snapshot will be lost, so shut down any services on the physical machine first.

Check which disks you want to capture and run the tool. You will have a new virtual hard disk that you can attach to a virtual machine when the job is finished. Your original physical server is left untouched so make sure you run either the physical machine or the virtual machine, but not both on the same network at the same time.

Disk2vhd V2.0

Running Disk2vhd to convert a physical disk to a VHDX


Neither of these free tools is supported by Microsoft. However, the creators of these tools have tested them pretty well, and at this time the tools support the latest editions of Windows and Hyper-V.

Related Topics:

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by:

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: