How to Configure Hyper-V Virtual Machine Settings on Windows Server 2012 R2
Hyper-V in Windows Server 2012 R2 provides a robust hypervisor platform capable of running dozens of virtual machines on a single physical host. Understanding how to configure virtual machine settings correctly — from CPU allocation to memory management, network adapters, and storage controllers — is fundamental to running a healthy virtualisation environment. This guide covers the core VM configuration options available through both Hyper-V Manager and PowerShell.
Prerequisites
Before configuring VM settings, ensure the following are in place:
- Windows Server 2012 R2 with the Hyper-V role installed
- Administrative privileges on the Hyper-V host
- At least one virtual machine already created (stopped VMs allow more settings changes)
- Hyper-V Manager open, or a PowerShell session with the Hyper-V module loaded
Understanding VM Configuration Versions
Windows Server 2012 R2 Hyper-V uses configuration version 5.0 for virtual machines. This version stores VM settings in an XML-based .xml file and runtime state in a .bin and .vsv file. Understanding that VM settings are stored on-disk means that configuration changes take effect either immediately (for hot-add supported features) or at the next VM start.
Configuring Virtual Processors
Virtual processors (vCPUs) determine how much compute capacity a VM can utilise. Windows Server 2012 R2 supports up to 64 virtual processors per VM. To configure vCPUs via PowerShell:
Set-VMProcessor -VMName "MyVM" -Count 4
To also enable NUMA topology and limit CPU resource usage:
Set-VMProcessor -VMName "MyVM" -Count 4 -Maximum 80 -Reserve 10 -RelativeWeight 100
The -Maximum parameter caps the percentage of physical CPU cycles the VM can use. -Reserve guarantees a minimum allocation. -RelativeWeight prioritises CPU scheduling relative to other VMs when resources are contended.
Configuring Memory Settings
Windows Server 2012 R2 supports both static memory and Dynamic Memory for VMs. Static memory assigns a fixed amount, while Dynamic Memory allows the hypervisor to reclaim unused RAM from idle VMs and redistribute it.
To set static memory:
Set-VMMemory -VMName "MyVM" -DynamicMemoryEnabled $false -StartupBytes 4GB
To enable Dynamic Memory with minimum, maximum, and startup values:
Set-VMMemory -VMName "MyVM" -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 2GB -MaximumBytes 8GB -Buffer 20
The -Buffer percentage tells Hyper-V to try to keep that much extra memory available above what the guest OS is currently using, reducing balloon driver activity.
Configuring Network Adapters
Virtual machines connect to the network via virtual network adapters attached to virtual switches. To add a network adapter to a VM:
Add-VMNetworkAdapter -VMName "MyVM" -SwitchName "ExternalSwitch" -Name "Production NIC"
To enable features like MAC address spoofing (required for nested virtualisation or certain clustering scenarios) or bandwidth management:
Set-VMNetworkAdapter -VMName "MyVM" -Name "Production NIC" -MacAddressSpoofing On
Set-VMNetworkAdapterBandwidthSetting -VMName "MyVM" -Name "Production NIC" -MaximumBandwidth 1000000000
To configure VLAN tagging on a virtual network adapter:
Set-VMNetworkAdapterVlan -VMName "MyVM" -Access -VlanId 100
Configuring Storage Controllers and Virtual Hard Disks
Generation 1 VMs use IDE and SCSI controllers, while Generation 2 VMs use only SCSI. IDE controllers are limited to 4 devices total (2 per controller), while SCSI controllers support up to 64 devices each, with up to 4 SCSI controllers per VM.
To add a SCSI controller and attach a new VHDX disk:
Add-VMScsiController -VMName "MyVM"
New-VHD -Path "C:VMsMyVM-Data.vhdx" -SizeBytes 100GB -Dynamic
Add-VMHardDiskDrive -VMName "MyVM" -ControllerType SCSI -ControllerNumber 1 -ControllerLocation 0 -Path "C:VMsMyVM-Data.vhdx"
To convert a fixed VHD to a dynamically expanding VHDX (offline operation):
Convert-VHD -Path "C:VMsMyVM-OS.vhd" -DestinationPath "C:VMsMyVM-OS.vhdx" -VHDType Dynamic
Configuring Integration Services
Integration Services provide communication between the host and guest OS, enabling features like time synchronisation, heartbeat monitoring, shutdown, and data exchange. To check which integration services are enabled:
Get-VMIntegrationService -VMName "MyVM"
To enable a specific integration service:
Enable-VMIntegrationService -VMName "MyVM" -Name "Guest Service Interface"
Configuring VM Boot Order
For Generation 2 VMs, you can configure the UEFI boot order. For Generation 1, the BIOS boot order is fixed to CD/DVD, then network (PXE), then hard disk. For Generation 2:
$VMObj = Get-VM -Name "MyGen2VM"
$BootOrder = $VMObj | Get-VMFirmware | Select-Object -ExpandProperty BootOrder
Set-VMFirmware -VMName "MyGen2VM" -BootOrder $BootOrder[1], $BootOrder[0], $BootOrder[2]
Configuring Automatic Start and Stop Actions
To ensure VMs start and stop gracefully when the host is rebooted:
Set-VM -VMName "MyVM" -AutomaticStartAction Start -AutomaticStartDelay 30 -AutomaticStopAction ShutDown
The -AutomaticStartDelay staggers VM startup to avoid simultaneous resource contention. AutomaticStopAction can be TurnOff, Save, or ShutDown. Using ShutDown sends a graceful shutdown signal via Integration Services.
Viewing All VM Configuration Details
To get a comprehensive view of all settings for a VM:
Get-VM -Name "MyVM" | Select-Object *
For memory details:
Get-VMMemory -VMName "MyVM"
For network adapter details:
Get-VMNetworkAdapter -VMName "MyVM"
Modifying Settings on a Running VM
Windows Server 2012 R2 Hyper-V supports hot-add and hot-remove of certain resources without stopping the VM. These include:
- SCSI virtual hard disk drives (hot-add and hot-remove)
- Network adapters (hot-add and hot-remove)
- Dynamic Memory adjustments
IDE disk changes, virtual processor count changes, and static memory changes require the VM to be in a saved or off state. Always verify the VM state before making changes:
Get-VM -Name "MyVM" | Select-Object Name, State
Verifying Configuration
After making changes, verify the configuration was applied correctly:
Get-VMProcessor -VMName "MyVM"
Get-VMMemory -VMName "MyVM"
Get-VMNetworkAdapter -VMName "MyVM"
Get-VMHardDiskDrive -VMName "MyVM"
To export a summary of all VMs and their key settings for documentation:
Get-VM | Select-Object Name, State, MemoryAssigned, ProcessorCount | Format-Table -AutoSize
Summary
Configuring Hyper-V VM settings on Windows Server 2012 R2 covers a broad range of options from processor and memory allocation to network adapters, storage controllers, integration services, and boot order. PowerShell cmdlets from the Hyper-V module provide precise control over every setting, while Hyper-V Manager offers a GUI for visual administration. Understanding which changes require the VM to be offline versus which support hot-change is critical for maintaining service availability in production environments. Always document your VM configurations and use consistent naming conventions across your Hyper-V infrastructure to simplify management at scale.