Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

VM Creation

Direct answer

Hyper-V VM creation automation uses New-VM with -Generation 2, memory, VHDX path and switch, then Set-VMProcessor, Set-VMMemory and Add-VMDvdDrive or a template disk to build VMs consistently.

When to use this

Use this when creating Hyper-V VMs by script.

First 30 seconds

1. VM creation: Gen2, VHDX, switch, CPU/memory, Secure Boot template.

2. Add to cluster for HA.

3. Name and tag consistently.

4. Customise with unattend/sysprep.

5. Register in systems.

Operational verification

parameters → New-VM → configure → cluster role → start

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Hyper-V PowerShell automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformHyper-V PowerShell automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when creating Hyper-V VMs by script.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

The negative fixture should deliberately exercise risks such as name collisions, cluster ownership changes, path/capacity mismatch, checkpoints/locks, asynchronous completion, replication lag and host success without guest/application success, choosing the cases most relevant to VM ID/name, generation, CPU/memory/firmware, storage/network attachment, placement and proving the guest reaches the intended boot/management state.

Step 2 Common mistakes Narrow the fault
  • Generation 1 VMs created by default where Gen 2 is wanted.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Use Generation 2 for modern OSes.
  • Set memory, CPU, disk and switch.
  • Template disks speed deployment.
Key checks
  • New-VM -Name <n> -Generation 2 -MemoryStartupBytes 4GB -SwitchName <sw> -NewVHDPath <p> -NewVHDSizeBytes 60GB — create
  • Add-ClusterVirtualMachineRole -VMName <n> — make HA
  • Start-VM <n> — start
ReferenceWhy it matters1 section · depth on demand

What it is

Hyper-V VMs are created with New-VM and configured with Set-VM* cmdlets.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

VM creation on Hyper-V is scripted with the Hyper-V PowerShell module: create the VM, attach a virtual disk (often a differencing or copied sysprepped VHDX), connect the network adapter and start it.

New-VM -Name app-oslo-014 -Generation 2 -MemoryStartupBytes 8GB `
  -VHDPath 'D:\VMs\app-oslo-014.vhdx' -SwitchName 'vSwitch-Prod'
Set-VMProcessor app-oslo-014 -Count 4
Set-VMNetworkAdapterVlan -VMName app-oslo-014 -Access -VlanId 120
Set-VMFirmware app-oslo-014 -EnableSecureBoot On
Start-VM app-oslo-014

In clusters, create VMs on Cluster Shared Volumes and add them to the cluster (Add-ClusterVirtualMachineRole), or they will not fail over.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docHyper-V PowerShell automation current

Authoritative/upstream documentation reviewed for bounded claims in Hyper-V Automation > VM Creation. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://learn.microsoft.com/en-us/powershell/module/hyper-v/?view=windowsserver2025-ps · confidence 94%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

For VM ID/name, generation, CPU/memory/firmware, storage/network attachment, placement and proving the guest reaches the intended boot/management state, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?