2. Creating virtual machines
You can create new virtual machines on a Hyper-V host by using
either Hyper-V Manager or Windows PowerShell.
You can also use the New-VM cmdlet to create a new virtual
machine using Windows PowerShell. For example, to create a new
virtual machine named SRV-A on HOST4, assign the virtual machine 1
GB of startup memory, attach it to the virtual switch named CONTOSO
Virtual Switch, create a new virtual hard disk (VHDX file) of size
500 GBs in the default location, and make the virtual CD drive the
default boot device, use the following command:
PS C:\> New-VM -ComputerName HOST4 -Name SRV-A -MemoryStartupBytes 1GB `
-BootDevice CD -SwitchName "CONTOSO Virtual Switch" -NewVHDSizeBytes 500GB `
-NewVHDPath SRV-A.vhdx
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status
---- ----- ----------- ----------------- ------ ------
SRV-A Off 0 0 00:00:00 Operating normally
Importing virtual machines
Importing existing virtual machines onto a Hyper-V host can
also be performed using either Hyper-V Manager or Windows
PowerShell. For example, to import a virtual machine using Hyper-V
Manager, select the target host and click Import Virtual Machine in
the Actions pane. This launches the Virtual Machine Import Wizard.
As Figure 1 shows,
you can use this wizard to perform the various import scenarios
described earlier in this lesson.
To import virtual machines using Windows PowerShell, use the
Import-VM cmdlet.