Hyper-V lab for SQL server

Posted in: Technical Track

Whether you are playing with features or learning them in a server operating system, or SQL Server, you need to first have somewhere to run it all. All of us would love to have a server rack in our garage/basement/workshop, but that incurs a pretty high cost. You might consider using Azure or AWS services, which for the most part are a good source. Once you get into working with SQL Server though, the price for both cloud providers can fluctuate pretty high based on what feature or component you want to play with or learn. If you have an offline lab that runs locally on your computer it makes it so much easier to play and learn at your own pace, and not worry about what the bill will be each month.

Virtual Software Options

You have a few options here, but the most popular you will see folks mention:

Oracle VM VirtualBox
VMWare Player
VMWare Workstation (Requires $$$)
Client Hyper-V (Used to be called Virtual PC prior to Windows 8)

I have had the luxury of using each one of these through my career and they all work well. It just depends on what features you prefer and are more attracted to as to which one you should use. It will really depend on what part of the OS or SQL Server you want to try as to which one you can use. If for example you want to play with clustering or Availability Groups, VMWare Player is not something you can use because it does not support the virtual switch required for your servers to talk to each other. Just make sure you do your research before jumping into one over the other.

My preference

I have favored Hyper-V since I moved to Windows 10 on my primary machine. It just seems to perform the best over the other products above I tried on my hardware. A co-worker blogged about his likes/dislikes with Hyper-V when it came out for Windows 8. While most of his dislikes have not been necessarily fixed, you just have to understand: Hyper-V is a server technology that was adjusted to fit on a client OS. You are not going to have direct, or seamless, interaction with the servers as you will find the other products like VirtualBox or VMware Workstation. In Hyper-V world you interact with the servers just like you would in a production environment: using Remote Desktop or putty (depending on the OS flavor). If you follow this you will see most of the dislikes noted become obsolete.

One cool thing you get with Hyper-V is the ability to manage the virtual machines through PowerShell. It allows a much smoother and repeatable build process for the VMs. The OS install is still clicking (or typing) through the wizards. Though, for me Window Server 2012 R2 does not take all that long to install. You can save some time with the OS installations by building out a template to use. The template in this case is just the VHDX file you create as the system drive. You can sysprep the OS and then copy that file over and over, once you copy and attach it to a new VM you get a running Windows Server VM.

Building the Lab

Obviously what you build is based on what you want to play with, or learn against. In most cases though, with any lab for SQL Server your lab will include a domain controller and then the server(s) running SQL Server. My preference on the domain controller is to utilize Windows Server 2012 Core Edition, for a handful of reasons:

1. No GUI = no resources used to render it all.
2. Smaller footprint – less storage required.
3. Tremendous cut down on Windows Updates that are required.

So while most everyone already knows how to install the full edition of Window Server, Core Edition can be a challenge. Instead of filling this post with screenshots I decided to build out a slide deck on building a full lab with Hyper-V. This slide deck walks you through the PowerShell commands for Hyper-V, and then setting up a server running Core Edition as a template. I also include walking through building a server using the template.

I have a slide deck landing page that you can find the slide deck, or you can go to it directly from here. The slide deck requires no special software or plugins to view. It is broken down into the following sections that you can jump right to if you want:

Virtual Network Switch
Create a VM
Building a Template
Create VM using the Template

I did not include building a domain controller under Windows Core Edition…working on that for the next post.


Hope you found the information and slide deck informative, and be sure to check back for the Active Directory deck.

The content of this post can also be found here.



Want to talk with an expert? Schedule a call with our team to get the conversation started.

About the Author

Microsoft Cloud and Datacenter Management MVP, Shawn has a knack for automating mundane task where IT staff can focus on more business critical issues and task. He has been recognized for his skills in PowerShell and has a broad knowledge of technology around Microsoft's Data Platform and various Cloud providers.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *