Use the following procedures to build out test lab environments that are described in Microsoft Test Lab Guides (TLGs) using Windows Server 2012 Hyper-V.

Creating a new private virtual switch

1.       From the Start screen, click Hyper-V Manager.
2.       In the Hyper-V Manager console, click Virtual Switch Manager in the Actions pane.
3.       In the Virtual Switch Manager window, click New virtual network switch. Under What type of virtual switch do you want to create?, select Private, and then click Create Virtual Switch.
4.       Under Name, replace the default name with the name of the subnet (for example, Corpnet), and then click Apply.
5.       Click OK to close Virtual Switch Manager.
 
Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

New-VmSwitch -Name <SwitchName> -SwitchType Private
See New-VMSwitch for additional information.
 
  

Creating a new virtual machine

1.       From the Start screen, click Hyper-V Manager.
2.       In the Hyper-V Manager console, in the Actions pane, click New, and then click Virtual Machine.
3.       On the Before You Begin page of the New Virtual Machine Wizard, click Next.
4.       On the Specify Name and Location page, type the name of the test lab computer in Name (for example, DC1), and then click Next.
5.       On the Assign Memory page, type the amount of memory to allocate to the virtual machine in megabytes (for example, 2048 for 2 GB of memory), and then click Next.
6.       On the Configure Networking page, click the name of the virtual switch to which the virtual machine is connected in Connection (for example, Corpnet), and then click Next.
7.       On the Connect Virtual Hard Disk page, in Size under Create a virtual hard disk, type the size of the virtual hard disk in gigabytes, and then click Next.
8.       On the Installation Options page, click Next.
9.       On the Summary page, click Finish.
 
Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

New-VM –Name <VMName> –MemoryStartupBytes <MemorySize> -NewVHDSizeBytes <DiskSize> –SwitchName <VirtualSwitchName>
 See New-VM for additional information.

Adding a network adapter to a new virtual machine

  1. In the Hyper-V Manager console, right-click the name of the new virtual machine, and then click Settings.
  2. In the Settings dialog box, click Add Hardware in the Hardware pane.
  3. In the Add Hardware pane, click Network Adapter and then click Add.
  4. In the Network Adapter pane, in Virtual switch, select the name of the virtual switch to which this network adapter is connected, and then click OK.

Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

Add-VMNetworkAdapter –VMName <VMName> –SwitchName <VirtualSwitchName>
See Add-VMNetworkAdapter for additional information.

Installing an operating system on a new virtual machine

If you have the operating system DVD in the DVD drive of the Hyper-V server, do the following:

  1. Right-click the name of the virtual machine, and then click Settings.
  2. In the Settings dialog box, click DVD Drive in the Hardware pane.
  3. In the DVD Drive pane, in Media, click Physical CD/DVD drive and then select the physical drive of the Hyper-V corresponding to where the operating system DVD is located. Click OK.
  4. In the Virtual Machines list, right-click the name of the new virtual machine, and then click Start.
  5. In the Virtual Machines list, right-click the name of the new virtual machine, and then click Connect.
  6. Hyper-V opens a Virtual Machine Connection window and runs setup from the DVD drive.

If you have an operating system ISO file stored on a location that is accessible from the Hyper-V server, do the following:

  1. Right-click the name of the virtual machine, and then click Settings.
  2. In the Settings dialog box, click DVD Drive in the Hardware pane.
  3. In the DVD Drive pane, in Media, click Image file, click Browse, and then select the ISO file that contains the operating system to install. Click OK.
  4. In the Virtual Machines list, right-click the name of the new virtual machine, and then click Start.
  5. In the Virtual Machines list, right-click the name of the new virtual machine, and then click Connect.
  6. Hyper-V opens a Virtual Machine Connection window and runs setup from the DVD drive.

Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

New-VmSwitch -Name <SwitchName> -SwitchType Private
See New-VMSwitch for additional information.
Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

New-VmSwitch -Name <SwitchName> -SwitchType Private
See New-VMSwitch for additional information.
Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

New-VmSwitch -Name <SwitchName> -SwitchType Private
See New-VMSwitch for additional information.