26 lines
883 B
PowerShell
26 lines
883 B
PowerShell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
|
|
|
|
#reboot
|
|
|
|
New-VMSwitch -name ExternalSwitch -NetAdapterName Ethernet -AllowManagementOS $true
|
|
|
|
$vms = @{
|
|
Name = 'rmote1'
|
|
Generation = '2'
|
|
MemoryStartupBytes = 4GB
|
|
NewVHDPath = 'D:\VMs\rmote1\rmote1.vhdx'
|
|
NewVHDSizeBytes = 127GB
|
|
SwitchName = 'ExternalSwitch'
|
|
}
|
|
New-VM @vms
|
|
Add-VMDvdDrive `
|
|
-VMName $vms.Name `
|
|
-Path C:\Users\keplradmin\Documents\Windows.iso
|
|
Set-VM -VMName $vms.Name -AutomaticStartAction Start
|
|
Set-VM -Name $vms.Name -AutomaticStopAction Shutdown
|
|
Set-VMProcessor -VMName $vms.Name -Count 4
|
|
Set-VMMemory -VMName $vms.Name -DynamicMemoryEnabled $true -MinimumBytes 4GB -StartupBytes 4GB -MaximumBytes 8GB -Priority 50 -Buffer 20
|
|
Set-VMFirmware -VMName $vms.Name `
|
|
-FirstBootDevice ((Get-VMFirmware -VMName $vms.Name).BootOrder |
|
|
Where-Object Device -like *DvD*).Device
|