Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get IP address of all virtual machines running on hyper V

is there any way to get IP addresses of all running Virtual machines with PowerShell? I have tried the following

Get-VM | ?{$_.State -eq "Running"} | Select -ExpandProperty networkadapters

Get-VM | ?{$_.State -eq "Running"} | Get-VMNetworkAdapter | Select VMName, IPAddresses

I am able to get list of virtual machines but I'm not getting any IP addresses for them

like image 470
Kaustubh_Kharche Avatar asked Sep 23 '14 19:09

Kaustubh_Kharche


People also ask

Does each VM have its own IP address?

VM interfaces are assigned IP addresses from the subnet that they are connected to. Each VM interface has one primary internal IPv4 address, which is assigned from the subnet's primary IPv4 range. If the subnet has an internal IPv6 range, the VM interface can optionally be configured with an internal IPv6 address.

How can I see all virtual machines?

To see all VMs on the local Hyper-V host, you should run the Get-VM cmdlet. On the PowerShell screen, you can see the list of available VMs, including their name, state, CPU usage, memory assigned, uptime, status, and version.

How do I find the VM IP address in PowerShell?

From inside of the virtual machine, simply use the IPConfig command to see the IP addresses that the VM is using.


1 Answers

In either PowerShell or Windows Batch, you can use arp -a to list IP addresses of everything on your Windows machine (both real and Hyper-V machines are listed). You can filter on Mac address to get precisely the IP you're looking for.

arp -a | findstr 00-15-5d-19-73-00
  172.17.210.62         00-15-5d-19-73-00     static
like image 71
Stephen Quan Avatar answered Sep 28 '22 04:09

Stephen Quan