The essentials

Quick reference

One focused task per row. Jump to the related section for complete, working examples.

UseSyntaxExamples
List virtual machinesGet-VM | Sort-Object NameView examples
Inspect one VMGet-VM -Name 'App-Test-01' | Format-List Name, VMId, State, Status, Generation, Version, PathView examples
Inspect host defaultsGet-VMHost | Format-List ComputerName, VirtualMachinePath, VirtualHardDiskPath, LogicalProcessorCountView examples
Inspect VM memoryGet-VMMemory -VMName 'App-Test-01'View examples
Inspect virtual processorsGet-VMProcessor -VMName 'App-Test-01'View examples
Inspect network adaptersGet-VMNetworkAdapter -VMName 'App-Test-01' | Select-Object Name, SwitchName, MacAddress, Status, IPAddressesView examples
List virtual switchesGet-VMSwitch | Select-Object Name, SwitchType, NetAdapterInterfaceDescriptionView examples
Preview VM creationNew-VM -Name 'App-Test-01' -Generation 2 ` -MemoryStartupBytes 4GB -NoVHD -SwitchName ` 'Lab-Switch' -WhatIfView examples
Preview dynamic memorySet-VMMemory -VMName 'App-Test-01' -DynamicMemoryEnabled ` $true -MinimumBytes 2GB -StartupBytes 4GB ` -MaximumBytes 8GB -WhatIfView examples
Start a VMStart-VM -Name 'App-Test-01' -WhatIfView examples
Request guest shutdownStop-VM -Name 'App-Test-01' -Shutdown -WhatIfView examples
List checkpointsGet-VMCheckpoint -VMName 'App-Test-01' | Sort-Object CreationTimeView examples
Create named checkpointCheckpoint-VM -Name 'App-Test-01' -SnapshotName ` 'Before-App-Upgrade' -WhatIfView examples
Preview checkpoint restoreRestore-VMCheckpoint -VMName 'App-Test-01' -Name ` 'Before-App-Upgrade' -WhatIfView examples
Preview VM exportExport-VM -Name 'App-Test-01' -Path 'E:/VMExports' ` -WhatIfView examples
Inspect an import planCompare-VM -Path ` 'E:/VMExports/App-Test-01/Virtual Machines/VM-ID.vmcx' ` -Copy -GenerateNewIdView examples

Hyper-V cmdlets control host resources and durable virtual-machine state, often across storage and network boundaries. Run administrative changes from an elevated session, resolve the exact host and VM before acting, preserve console or cluster access, and treat checkpoints as short-lived change controls rather than backups. Commands below use explicit names and preview state changes where the cmdlet supports WhatIf.

Step by step

Detailed examples

01

Resolve host and VM identity before every change

A display name is convenient but can be reused after deletion, while VMId identifies one registered VM. Confirm the target host, VMId, generation, configuration version, paths, state, and cluster ownership before mutation. Most Hyper-V administration requires elevation or delegated Hyper-V Administrators rights; remote or clustered changes need an out-of-band recovery path.

Capture a host and VM identity baseline
Get-VMHost | Select-Object ComputerName, VirtualMachinePath, VirtualHardDiskPath
Get-VM -Name 'App-Test-01' | Select-Object Name, VMId, State, Status, Generation, Version, Path
Back to quick reference ↑
02

Correlate compute, disks, and network configuration

A healthy VM object does not prove that memory pressure, disk placement, switch connectivity, or guest networking is correct. Inspect resource objects separately. IPAddresses are reported through integration services and can be empty or stale; validate connectivity from the intended network rather than treating them as authoritative inventory.

Review resource attachments without changing them
Get-VMMemory -VMName 'App-Test-01'
Get-VMProcessor -VMName 'App-Test-01'
Get-VMHardDiskDrive -VMName 'App-Test-01' | Select-Object ControllerType, ControllerNumber, ControllerLocation, Path
Get-VMNetworkAdapter -VMName 'App-Test-01' | Select-Object Name, SwitchName, MacAddress, Status, IPAddresses
Back to quick reference ↑
03

Create from an explicit resource and storage plan

Choose generation, boot model, storage paths, virtual switch, memory bounds, CPU count, firmware, and security requirements before creation. Generation cannot be changed later. Preview supported cmdlets, ensure every VHD path is backed up or disposable as appropriate, and verify the VM while it remains off before connecting installation media or a production network.

Preview creation and bounded memory
Get-VMSwitch | Select-Object Name, SwitchType, NetAdapterInterfaceDescription
New-VM -Name 'App-Test-01' -Generation 2 -MemoryStartupBytes 4GB -NoVHD -SwitchName 'Lab-Switch' -WhatIf
Set-VMMemory -VMName 'App-Test-01' -DynamicMemoryEnabled $true -MinimumBytes 2GB -StartupBytes 4GB -MaximumBytes 8GB -WhatIf
Back to quick reference ↑
04

Prefer guest-coordinated lifecycle operations

Starting a VM consumes host capacity. Stop-VM -Shutdown asks an integration service to shut down the guest cleanly and can fail if the service or guest is unresponsive. Stop-VM -TurnOff is equivalent to removing power and risks guest data corruption; use it only under an approved incident procedure. Recheck state and critical workloads after any transition.

Preview a lifecycle transition and verify state
Get-VM -Name 'App-Test-01' | Select-Object Name, State, Status, Uptime
Stop-VM -Name 'App-Test-01' -Shutdown -WhatIf
Get-VM -Name 'App-Test-01' | Select-Object Name, State, Status
Back to quick reference ↑
05

Use production checkpoints as temporary rollback aids

Production checkpoints request an application-consistent guest snapshot; ProductionOnly prevents silent fallback to a standard memory-state checkpoint. A checkpoint is not an independent backup, grows differencing disks, and restoring it discards later guest state. Replicated services such as domain controllers and databases require product-specific recovery guidance. Remove checkpoints only after validation and allow merges to finish.

Set policy and preview a controlled checkpoint
Set-VM -Name 'App-Test-01' -CheckpointType ProductionOnly -WhatIf
Checkpoint-VM -Name 'App-Test-01' -SnapshotName 'Before-App-Upgrade' -WhatIf
Get-VMCheckpoint -VMName 'App-Test-01' | Select-Object Name, Id, CreationTime, CheckpointType
Back to quick reference ↑
06

Treat export and import as verified recovery workflows

An export can include configuration, virtual disks, and checkpoints, but it is not a substitute for application-aware backup policy. Confirm destination capacity and protection, wait for completion, inventory files, and test recovery on an isolated switch. Compare-VM reports incompatibilities before import; copy/import with a new ID when creating a distinct VM to avoid identity collisions.

Preview export and inspect an import compatibility report
Export-VM -Name 'App-Test-01' -Path 'E:\VMExports' -WhatIf
$report = Compare-VM -Path 'E:\VMExports\App-Test-01\Virtual Machines\VM-ID.vmcx' -Copy -GenerateNewId
$report.Incompatibilities | Select-Object Message, MessageId, Source
Back to quick reference ↑

Sources and further reading

References

Authoritative documentation used to verify and expand this cheat sheet.

  1. MicrosoftHyper-V Modulelearn.microsoft.com
  2. MicrosoftNew-VMlearn.microsoft.com
  3. MicrosoftUsing checkpointslearn.microsoft.com
  4. MicrosoftExport and import virtual machineslearn.microsoft.com

Help us improve

Found a typo or missing example?

Tell us what would make this cheat sheet clearer, more complete, or more useful.

Share feedback