If you’re in IT, you’re probably testing new stuff out pretty often, and maybe you don’t want to be stuck with TechNet’s Virtual Labs, which only simulate pre-made environments. Maybe you want to make and break your own environments — and you should.

The Server 2012 Exam 70-410 requires knowledge of both Hyper-V and PowerShell, so let’s see what we can do with both.

Installing Hyper-V

HowToGeek Introduction.
Dell РHyper-V System Requirements (How to check compatibility)

Installing Hyper-V requires your computer to meet the following:

  • Processor¬ must be 64-bit and supports SLAT. Intel i3, i5, i7 and later are fine; older ones may not be.
  • Operating System must be the¬ 64-Bit¬†version of¬ Windows 8 Pro or later.

Hyper-V also runs on Windows Server 2008 or later, but chances are, you aren’t running that on your home PC.

Check the HowToGeek intro for a walkthrough of the install process (it’s really simple) and basic VM setup instructions. If you want a PowerShell way to do it, then here you go:

Enable-WindowsOptionalFeature ‚ÄďOnline ‚ÄďFeatureName Microsoft-Hyper-V

My Test Lab Configuration

I currently have six Hyper-V virtual machines set up in a sort of private domain network:

Hyper-V SEtup

One machine is a domain controller, running Windows Server 2012 R2. This server hosts the domain, so it must be on for the other machines to log users into the domain.

I have two other Server 2012 R2 VMs for testing. One is running Server Core, which has no GUI, just a command line. On Server 2012 R2, I can switch back and forth between the Core and regular versions with a few PowerShell commands, but having one server run each can sometimes be more convenient if I want to try to test one operation out in each version of Windows Server.

I then have three client VMs, one running Windows 7, one running Windows 8, and one running Windows 10.

The “main” domain server runs Active Directory with several user groups and about ten different user accounts, enough that I can run the PowerShell Active Directory cmdlets and get some meaningful results. For info on installing an active directory domain, check out this excellent step-by-step guide on TechNet. The bottom of that guide shows PowerShell commands for doing it as well.

With this kind of setup, I login to my Windows 8 or Windows 10 VMs to run the active directory cmdlets; I only login to the domain controller itself when I want to add and remove features or roles for the server — Exam 70-410¬ also requires knowledge of the PowerShell commands required to do that.

What Can PowerShell Manage on Hyper-V?

PowerShell can be used to create and configure VMs, take snapshots on one or more VMs at a time, can delete VMs, and can even clone VMs using a snapshot taken on one of them. The “coolest” stuff like that are more involved scripts that require knowledge of things I haven’t gone over yet.¬†A script could delete and recreate a particular VM if it blows up on you.

Hyper-V Cmdlets (TechNet)

Here’s a more involved tutorial on setting up a lab for testing PowerShell’s Desired State Configuration (DSC), part of which involves using PowerShell to setup a few different VMs at once:

http://mattblogsit.com/windows/building-a-desired-state-configuration-dsc-lab