How to Create Hyper-V VM with PowerShell under 2 Minutes (2025 Guide)

Clicking through Hyper-V Manager to create VMs one by one? There's a faster way. With PowerShell, you can create a fully configured Hyper-V virtual machine in under 2 minutes. Let me show you how to do it.
How to Create Hyper-V VM with PowerShell by Jasmin Kahriman

With PowerShell, you can create a fully configured Hyper-V virtual machine in under 2 minutes; no clicking through wizards, no manual configuration.

This tutorial shows you the exact PowerShell commands to automate VM creation on Windows Server 2016/2019/2025 and Hyper-V Server core.

Why PowerShell?

When creating VMs in Hyper-V, we can use the graphical interface through Hyper-V Manager or PowerShell. PowerShell commands can be executed directly on the Hyper-V instance or remotely from any machine that has access to the Hyper-V server.

PowerShell also helps us with bulk creation and configuration, as well as automation and scripting. In one of my blog articles, I also use PowerShell to monitor created checkpoints. Read it here.

Prerequisites

In order to create VMs on your Hyper-V server using PowerShell, there are a couple of prerequisites, including:

  • Running Hyper-V Server
  • ISO file of the OS you want to install
  • Enough resources to create additional VM(s)
  • An account with administrative permissions

I am going to create a virtual machine configured with Windows Server 2019, 16 GB of RAM, and 200 GB of disk space.

✍️ I’ve published over 500 blog articles, including 50+ on Hyper-V covering implementation, management, troubleshooting, and backup using various products. Are you interested in expert technical content for your website or blog? Want to promote your product on my blog?
LET’S TALK →

In this guide, we’ll manually create a VM using an ISO file. However, in production environments, this entire process is often automated through scripts for bulk VM deployment.

Step by Step

This step-by-step guide is executed directly on your Hyper-V server:

  1. Click on the Start Menu and search for PowerShell.
  2. Right-click on Windows PowerShell and select Run as administrator.
  3. If asked, click Yes to confirm running PowerShell as administrator.
  4. Type the command and press Enter.
New-VM -Name PRTGCoreServer -MemoryStartupBytes 16GB -BootDevice VHD -NewVHDPath 
D:\Hyper-V\prtgcore01.vhdx -Path D:\Hyper-V-NewVHDSizeBytes 100GB -Generation 2 -Switch LAN
ParameterDescription
New-VMCreates a new virtual machine in Hyper-V.
-NameThe display name of the virtual machine (e.g., “PRTGCoreServer”). This name appears in Hyper-V Manager.
-MemoryStartupBytesThe amount of RAM assigned to the VM at startup, specified in bytes (e.g., 16GB)
-BootDevice VHDSpecifies that the VM should boot from a virtual hard disk.
-NewVHDPathThe file path and name where the virtual disk will be created (e.g., D:\Hyper-V\prtgcore01.vhdx).
-PathThe directory where VM configuration files are stored (e.g., D:\Hyper-V).
-NewVHDSizeBytesThe maximum size of the virtual hard disk in bytes (e.g., 200GB)
-GenerationThe VM generation: Gen 1 (legacy BIOS) or Gen 2 (UEFI, recommended for Windows Server 2012 R2+).
-SwitchThe name of the virtual switch to connect the VM to the network (e.g., “External Switch”).
PowerShell command breakdown
  1. Mount the ISO file to the VM. We’ll use the Windows Server 2019 ISO downloaded from Microsoft.
Add-VMDvdDrive -VMName PRTGCoreServer -Path D:\ISO\WinSrv2019.iso
Mount the ISO file
ParameterDescription
Add-VMDvdDriveAdds a DVD drive to a virtual machine.
-VMNameVM display name (e.g., “PRTGCoreServer”)
-PathThe ISO file path (e.g., D:\ISO\WinSrv2019.iso)
PowerShell command breakdow
  1. Start the virtual machine.
Start-VM -Name PRTGCoreServer

You have successfully created a new virtual machine using PowerShell. If you navigate to Hyper-V and check the VM settings, you will see the exact same configuration as specified in PowerShell.

VM Configuration

Access the VM via Hyper-V Manager and go through the installation and configuration. As mentioned, this process can also be automated, but that is not covered in this blog article.

Question for you: Are you managing Hyper-V VMs manually or using automation? Share your setup in the comments below; I’d love to hear how you’re using PowerShell in your environment!

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link