Hyper-V
Hyper-V Powershell VM creation commands
Create new VM
Assuming the new vm name is lxdev150 and the drive path on the Hyper-V server is D:HyperV
Creates a new VM named lxdev150 taht has 64GB of RAM with all the VM files stored in D:HyperVlxdev150. Also creates a boot drive of 200GB named D:HyperVlxdev150Virtual Hard Diskslxdev150_0.vhdx and connects the network adapter to the 10Gbe-1 vSwitch
New-VM -name "lxdev150" -MemoryStartupBytes 64GB -Path "D:HyperVlxdev150" -Generation 2 -NewVHDPath "D:HyperVlxdev150Virtual Hard Diskslxdev150_0.vhdx" -NewVHDSizeBytes 200GB -SwitchName "10GbE-1 vSwitch"
Set number of virtual processors
Set-VMProcessor -VMName "lxdev150" -count 16
Add DVD drive and point to specific iso file
Add-VMDvdDrive -VMName "lxdev150" -Path "C:isofiles9c8cfbe8-dc7b-4d53-9f18-f5d4df14540f-discovery.iso"
Turn off Secure Boot (for linux)
Set-VMFirmware –VM "lxdev150" –EnableSecureBoot Off
Completely set the boot order to DVD, Hard Drive and Network
$network = Get-VMNetworkAdapter -VMName "lxdev150"
$vhd = Get-VMHardDiskDrive -VMName "lxdev150"
$dvd = Get-VMDvdDrive -VMName "lxdev150"
Set-VMFirmware -VMName "lxdev150" -BootOrder $dvd,$vhd,$network
Add a hard disk drive to a VM
New-VHD -Path "D:HyperVlxdev150Virtual Hard Diskslxdev150_1.vhdx" -SizeBytes 700GB -Dynamic
Add-VMHardDiskDrive -VMName "lxdev150" -Path "D:HyperVlxdev150Virtual Hard Diskslxdev150_1.vhdx"