I tried to take from the Hyper-V (Hyper-V 2012) node with this command the IP address:
Get-VM | select -ExpandProperty networkadapters | select vmname, ipaddress
The thing is that i take as an output only the assigned Private IP addresses and not the Public IP addresses that some VMs have. Any idea why i have this problem?
Also is there any way to take in the same output and the Vlan ID that i have in my VM settings?
To get the Vlan from a specific VM i can do it with this
Get-VM 'Name of the VM' | Get-VMNetworkAdapterVlan | select AccessVlanId
All of these things are on Hyper-V 2012 i want also this for Hyper-V 2008 R2. So some changes to the commands maybe required.
Best Answer
Not having Hyper-V 2012 available for me to test with, I can at least address the PowerShell part of your question: