#add host

New-vm -Name frmtempplate-192.168.0.1 -VM temp -VMHost 192.168.0.2 -Datastore 0.2

$myServer = Connect-VIServer -Server 192.168.0.1

#datacentor

Add-VMHost -Server $myServer -Name 192.168.0.2 -Location Infrastructure_lg -User root -Password 123 -Force

#portgroup

$vswitch =  Get-VirtualSwitch -VMHost 192.168.60.32 -Name vSwitch0

New-VirtualPortGroup -VirtualSwitch $vswitch  -Name "Vm Network vlan 1020" -Vlanid 1020

#start vm

start-vm -vm 192.168.20.124