Reputation: 775
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
Upvotes: 23
Views: 56487
Reputation: 938
There's an answer to your question by the Ed Wilson, "The Scripting Guy" here:
Adapting it to your case:
get-vm | ?{$_.State -eq "Running"} | select -ExpandProperty networkadapters | select vmname, macaddress, switchname, ipaddresses | ft -wrap -autosize
I hope this is still useful.
Upvotes: 40
Reputation: 26299
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
Upvotes: 25