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
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.