1

we have a physical machine with Type 1 Hypervisor and no GUI, we are trying to create a new VM using the below Powershell commands

$VMName = "MyTestVm"
$VMPath = "E:\Virtual-Machine"    
$VHDSizeGB = 200    
$SwitchName = "MyTestVmSwitch"    

New-VHD -Path "$VMPath\$VMName.vhdx" -SizeBytes ($VHDSizeGB * 1GB) -Dynamic    
New-VM -Name $VMName -Path $VMPath -MemoryStartupBytes 16GB -BootDevice VHD -Generation 2 -VHDPath "$VMPath\$VMName.vhdx"    
Add-VMNetworkAdapter -VMName $VMName -SwitchName $SwitchName    
Add-VMDvdDrive -VMName $VMName    
$ISOFile = "C:\Users\Downloads\SERVER_EVAL_x64FRE_en-us.iso"    
$DVDDrive = Get-VMDvdDrive -VMName $VMName    
Set-VMDvdDrive -VMName $VMName -Path $ISOFile    
Start-VM -Name $VMName    
Set-VMFirmware -VMName $VMName -FirstBootDevice (Get-VMDvdDrive -VMName $VMName)

After execution, VM is showing in the get-vm command, Please assist me get the IP address of the VM and let me know if I need to add anything to the code

expecting to get the public IP of the newly created VM on the physical machine, and I need to access the VM using a Remote desktop connection

0 Answers0