You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: WindowsServerDocs/virtualization/hyper-v/get-started/Create-a-virtual-machine-in-Hyper-V.md
+79-31Lines changed: 79 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,43 +1,89 @@
1
1
---
2
2
title: Create a virtual machine in Hyper-V
3
-
description: Gives instructions for creating a virtual machine using Hyper-V Manager or Windows PowerShell.
3
+
description: Learn how to create a virtual machine in Hyper-V using Hyper-V Manager or PowerShell. Follow step-by-step instructions to get started quickly.
4
+
#customer intent: As an IT admin, I want to create a virtual machine using Hyper-V Manager so that I can run isolated workloads on my server.
4
5
ms.topic: how-to
5
6
ms.author: roharwoo
6
7
author: robinharwood
7
-
ms.date: 01/29/2025
8
+
ms.date: 11/27/2025
8
9
---
9
10
10
11
# Create a virtual machine in Hyper-V
11
12
12
13
Learn how to create a virtual machine by using Hyper-V Manager and Windows PowerShell and what options you have when you create a virtual machine in Hyper-V Manager.
13
14
15
+
## Prerquisites
16
+
17
+
Before you create a virtual machine, make sure you have the following prerequisites:
18
+
19
+
- A computer running Windows Server or Windows client with Hyper-V enabled. For more information, see [Install the Hyper-V role on Windows Server](../get-started/Install-the-Hyper-V-role-on-Windows-Server.md).
20
+
- Membership in the local **Administrators** group or the **Hyper-V Administrators** group.
21
+
- Sufficient physical memory on the host to allocate to the virtual machine.
22
+
- Sufficient disk space for virtual machine configuration files and virtual hard disks.
23
+
- (Optional) A virtual switch configured if you want network connectivity for the virtual machine. See [Create a virtual switch for Hyper-V virtual machines](Create-a-virtual-switch-for-Hyper-V-virtual-machines.md).
24
+
- (Optional) An operating system installation media (.iso file) or an existing virtual hard disk (.vhd or .vhdx) if you want to install an operating system.
25
+
14
26
## Create a virtual machine
15
27
28
+
To create a virtual machine, use either Hyper-V Manager or Windows PowerShell. Select the method you prefer:
29
+
16
30
### [Hyper-V Manager](#tab/hyper-v-manager)
17
31
18
-
1. Open **Hyper-V Manager**.
32
+
To create a virtual machine in Hyper-V Manager, follow these steps:
33
+
34
+
1. Select the **Start** button, type **Hyper-V Manager**, and then select it from the list.
35
+
36
+
> [!NOTE]
37
+
> If you don't see Hyper-V Manager, make sure that the Hyper-V role is installed. For more information, see [Install the Hyper-V role on Windows Server](../get-started/Install-the-Hyper-V-role-on-Windows-Server.md).
38
+
39
+
1. In the left pane, under **Hyper-V Manager**, select your server.
40
+
41
+
1. From the **Actions** pane, select **New**, then select **Virtual Machine**.
42
+
43
+
1. From the **New Virtual Machine Wizard**, select **Next**.
44
+
45
+
1. For the **Specify Name and Location** page, enter a name for the virtual machine and choose a location to store the virtual machine configuration files. Select **Next**.
46
+
47
+
(Optionally) If you want to store the virtual machine configuration files in a different location, select the **Store the virtual machine in a different location** check box and then browse to the folder where you want to store the files.
48
+
49
+
1. In the **Specify Generation** page, select the generation of the virtual machine. For more information, see [Should I create a generation 1 or 2 virtual machine in Hyper-V?](../plan/Should-I-create-a-generation-1-or-2-virtual-machine-in-Hyper-V.md). Create a generation 2 virtual machine unless you have a specific reason to create a generation 1 virtual machine. Select **Next**.
50
+
51
+
1. For the **Assign Memory** page, enter the amount of memory to allocate to the virtual machine at startup. You can also choose to enable Dynamic Memory. For more information, see [Hyper-V Dynamic Memory Overview](../dynamic-memory.md). Select **Next**.
52
+
53
+
> [!NOTE]
54
+
> The minimum amount of memory you can assign is 32 MB and the maximum is 5,902 MB.
55
+
56
+
1. For the **Configure Networking** page, select a virtual switch to connect the virtual machine to the network. If you don't have a virtual switch created, you can skip this step and configure networking later. Select **Next**.
57
+
58
+
1. In the **Connect Virtual Hard Disk** page, choose one of the following options, then select **Next**:
59
+
60
+
-**Create a virtual hard disk** - Enter a name for the virtual hard disk, choose a location to store it, and specify its size.
19
61
20
-
1. In the left pane, under **Hyper-V Manager**, select your server.
62
+
-**Use an existing virtual hard disk** - Browse to the location of an existing virtual hard disk (`.vhd` or `.vhdx`).
21
63
22
-
1. From the**Actions** pane, select **New**, and then select **Virtual Machine**.
64
+
-**Attach a virtual hard disk later** - You can attach a virtual hard disk later.
23
65
24
-
1. From the **New Virtual Machine Wizard**, select **Next**.
66
+
1.For the **Installation Options** page, choose how you want to install the operating system on the virtual machine. You can choose one of the following options, then select **Next**:
25
67
26
-
1. Make the appropriate choices for your virtual machine on each of the pages. For more information, see [New virtual machine options and defaults in Hyper-V Manager](#options-in-hyper-v-manager-new-virtual-machine-wizard).
68
+
-**Install an operating system later**
27
69
28
-
1. After verifying your choices in the **Summary** page, select **Finish**.
70
+
-**Install an operating system from a bootable image file** - Browse to the location of an `.iso` file that contains the operating system installation media.
29
71
30
-
1. In Hyper-V Manager, right-click the virtual machine and select **Connect...**.
72
+
-**Install an operating system from a bootable floppy disk** - Select a floppy disk drive that contains the operating system installation media.
31
73
32
-
1. In the Virtual Machine Connection window, select **Action** > **Start**.
74
+
-**Install an operating system from a network-based installation server** - This option is for using Windows Deployment Services (WDS) or another network-based installation service.
75
+
76
+
1. After verifying your choices in the **Summary** page, select **Finish**.
33
77
34
78
### [PowerShell](#tab/powershell)
35
79
80
+
To create a virtual machine with Windows PowerShell using [New-VM](/powershell/module/hyper-v/new-vm), follow these steps:
81
+
36
82
1. On the Windows desktop, select the Start button and type **Windows PowerShell**.
37
83
38
84
1. Right-click on **Windows PowerShell** and select **Run as administrator**.
39
85
40
-
1. Getthe name of the virtual switch that you want the virtual machine to use by using the [Get-VMSwitch](/powershell/module/hyper-v/get-vmswitch) cmdlet:
86
+
1.Use the [Get-VMSwitch](/powershell/module/hyper-v/get-vmswitch) cmdlet to get the name of the virtual switch that you want the virtual machine to use:
41
87
42
88
```powershell
43
89
Get-VMSwitch * | Format-Table Name
@@ -48,10 +94,10 @@ Learn how to create a virtual machine by using Hyper-V Manager and Windows Power
48
94
> [!NOTE]
49
95
> If you move this virtual machine to a Hyper-V host that runs Windows Server 2012 R2, use the **-Version** parameter with **[New-VM](/powershell/module/hyper-v/new-vm)** to set the virtual machine configuration version to 5. The default virtual machine configuration version for Windows Server 2016 isn't supported by Windows Server 2012 R2 or earlier versions. You can't change the virtual machine configuration version after the virtual machine is created. For more information, see [Supported virtual machine configuration versions](../deploy/Upgrade-virtual-machine-version-in-Hyper-V-on-Windows-or-Windows-Server.md#supported-virtual-machine-configuration-versions).
50
96
51
-
-**Existing virtual hard disk** - To create a virtual machine with an existing virtual hard disk, you can use the following command where,
97
+
-**Existing virtual hard disk** - To create a virtual machine with an existing virtual hard disk, use the following command where,
52
98
-**-Name** is the name that you provide for the virtual machine that you're creating.
53
99
-**-MemoryStartupBytes** is the amount of memory that is available to the virtual machine at start up.
54
-
-**-BootDevice** is the device that the virtual machine boots to when it starts like the network adapter (NetworkAdapter) or virtual hard disk (VHD).
100
+
-**-BootDevice** is the device that the virtual machine boots to when it starts, like the network adapter (NetworkAdapter) or virtual hard disk (VHD).
55
101
-**-VHDPath** is the path to the virtual machine disk that you want to use.
56
102
-**-Path** is the path to store the virtual machine configuration files.
57
103
-**-Generation** is the virtual machine generation. Use generation 1 for VHD and generation 2 for VHDX. See [Should I create a generation 1 or 2 virtual machine in Hyper-V?.](../plan/Should-I-create-a-generation-1-or-2-virtual-machine-in-Hyper-V.md)
@@ -67,7 +113,7 @@ Learn how to create a virtual machine by using Hyper-V Manager and Windows Power
This creates a generation 2 virtual machine named TestVM with 4 GB of memory. It boots from the folder VMs\Test.vhdx in the current directory and uses the virtual switch named ExternalSwitch. The virtual machine configuration files are stored in the folder VMData.
116
+
This example creates a generation 2 virtual machine named TestVM with 4 GB of memory. It boots from the folder VMs\Test.vhdx in the current directory and uses the virtual switch named ExternalSwitch. The virtual machine configuration files are stored in the folder VMData.
71
117
72
118
- **New virtual hard disk** - To create a virtual machine with a new virtual hard disk, replace the **-VHDPath** parameter from the previous example with **-NewVHDPath** and add the **-NewVHDSizeBytes** parameter. For example,
73
119
@@ -77,7 +123,25 @@ Learn how to create a virtual machine by using Hyper-V Manager and Windows Power
77
123
78
124
- **New virtual hard disk that boots to operating system image** - To create a virtual machine with a new virtual disk that boots to an operating system image, see the PowerShell example in [Create virtual machine walkthrough for Hyper-V on Windows](/virtualization/hyper-v-on-windows/quick-start/create-virtual-machine).
79
125
80
-
1. Start the virtual machine by using the [Start-VM](/powershell/module/hyper-v/start-vm) cmdlet. Run the following cmdlet where Name is the name of the virtual machine you created:
126
+
---
127
+
128
+
## Start and connect to the virtual machine
129
+
130
+
After you create the virtual machine, you can start it and connect to it. You can use either Hyper-V Manager or Windows PowerShell. Select the method you prefer:
131
+
132
+
### [Hyper-V Manager](#tab/hyper-v-manager)
133
+
134
+
To start and connect to the virtual machine in Hyper-V Manager, follow these steps:
135
+
136
+
1. In Hyper-V Manager, right-click the virtual machine and select **Connect...**.
137
+
138
+
1. In the Virtual Machine Connection window, select **Action** > **Start**.
139
+
140
+
### [PowerShell](#tab/powershell)
141
+
142
+
To start and connect to the virtual machine using Windows PowerShell, follow these steps:
143
+
144
+
1. Start the virtual machine by using the [Start-VM](/powershell/module/hyper-v/start-vm) cmdlet. Run the following cmdlet where Name is the name of the virtual machine you created:
81
145
82
146
```powershell
83
147
Start-VM -Name <Name>
@@ -103,20 +167,6 @@ Learn how to create a virtual machine by using Hyper-V Manager and Windows Power
103
167
104
168
---
105
169
106
-
## Options in Hyper-V Manager New Virtual Machine Wizard
107
-
108
-
The following table lists the options you can pick when you create a virtual machine in Hyper-V Manager and the defaults for each.
109
-
110
-
|Page|Default for Windows Server 2016, Windows 10, and later|Other options|
|**Specify Name and Location**|Name: New Virtual Machine.<p>Location: **C:\ProgramData\Microsoft\Windows\Hyper-V\\**.|You can also enter your own name and choose another location for the virtual machine.<p>This is where the virtual machine configuration files are stored.|
113
-
|**Specify Generation**|Generation 1|You can also choose to create a Generation 2 virtual machine. For more information, see [Should I create a generation 1 or 2 virtual machine in Hyper-V?.](../plan/Should-I-create-a-generation-1-or-2-virtual-machine-in-Hyper-V.md)|
114
-
|**Assign Memory**|Startup memory: 1024 MB<p>Dynamic memory: **not selected**|You can set the startup memory from 32 MB to 5902 MB.<p>You can also choose to use Dynamic Memory. For more information, see [Hyper-V Dynamic Memory Overview](../dynamic-memory.md).|
115
-
|**Configure Networking**|Not connected|You can select a network connection for the virtual machine to use from a list of existing virtual switches. See [Create a virtual switch for Hyper-V virtual machines](Create-a-virtual-switch-for-Hyper-V-virtual-machines.md).|
116
-
|**Connect Virtual Hard Disk**|Create a virtual hard disk<p>Name: <*vmname*>.vhdx<p>**Location**: **C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\\**<p>**Size**: 127 GB|You can also choose to use an existing virtual hard disk or wait and attach a virtual hard disk later.|
117
-
|**Installation Options**|Install an operating system later|These options change the boot order of the virtual machine so that you can install from an .iso file, bootable floppy disk or a network installation service, like Windows Deployment Services (WDS).|
118
-
|**Summary**|Displays the options that you chose, so that you can verify they're correct.<p>- Name<br />- Generation<br />- Memory<br />- Network<br />- Hard Disk<br />- Operating System|**Tip:** You can copy the summary from the page and paste it into e-mail or somewhere else to help you keep track of your virtual machines.|
119
-
120
170
## Related content
121
171
122
172
-[New-VM](/powershell/module/hyper-v/new-vm)
@@ -126,5 +176,3 @@ The following table lists the options you can pick when you create a virtual mac
126
176
-[Should I create a generation 1 or 2 virtual machine in Hyper-V?](../plan/Should-I-create-a-generation-1-or-2-virtual-machine-in-Hyper-V.md)
127
177
128
178
-[Create a virtual switch for Hyper-V virtual machines](Create-a-virtual-switch-for-Hyper-V-virtual-machines.md)
0 commit comments