daknetworks.com

You are here: Blog Create Hyper-V VM from Powershell

Create Hyper-V VM from Powershell

Here you go:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
New-VM -Name MyMachine -path C:\installs\vm-machine -MemoryStartupBytes 512MB
New-VHD -Path C:\installs\vm-machine\MyMachine\mymachine.vhdx -SizeBytes 10GB -Dynamic
Add-VMHardDiskDrive -VMName MyMachine -path "C:\installs\vm-machine\MyMachine\mymachine.vhdx"
Set-VMDvdDrive -VMName MyMachine -ControllerNumber 1 -Path "C:\installs\vm-machine\MyMachine\connector-59.0.0.52.iso"

Adjust as needed.

Contact Dak Networks

Please contact us at the following.