PowerShell | Hyper-V | Create VM - Assign Access vlan - Set CPU

Опубликовано: 05 Октябрь 2024
на канале: InfraFort
395
1

Lets keep the channel going ! Please subscribe if this was helpful :)

Visit my website for more tech related news and info ! https://www.totaltechstuff.com/

Commands used;

$NameOfVM = "TESTVM01"
$SwitchName = "Switch"
$PathToStoreConfigs = "D:\Hyper-V"
$PathForVHDX = "D:\Hyper-V\VHD\TESTVHD01.vhdx"

#CREATE Virtual Machine
New-VM -Name $NameOfVM -MemoryStartupBytes 4GB -Generation 2 -SwitchName $SwitchName -Path $PathToStoreConfigs -VHDPath $PathForVHDX

#set processor count to 2
Set-VMProcessor $NameOfVM-Count 2

#Assign VLAN 100
Set-VMNetworkAdapterVlan -VMName $NameOfVM -VlanId 100 -Access