VMware Cloud Community
russjar
Enthusiast
Enthusiast
Jump to solution

NetworkName / Label Output

Hi all,

I'm not a powershell machine and need some help!

I need to run a script to get both the VMName and the NetworkName or the Label associated with that VM out. I can do one or the other but having difficulty putting it all together. I know this will be easy for someone so I will appreciate any help.

Don't want to be too fancy, just the NetworkName and the VMName. I know I should be able to build a pipeline but it's been a while since I've done any powershell stuff and I simply cannot remember.

Apriciations and thank you in advance.

$VIServer = Connect-VIServer -Server VirtualCenterServer

$VM = Get-VM

Get-NetworkAdapter -VM $VM | Select Name,NetworkName

VCP,MCSE NT4/W2k/W2k3, MCSA W2k3
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The VM's name is available in the Parent property.

You can do

$VIServer = Connect-VIServer -Server VirtualCenterServer

$VM = Get-VM

Get-NetworkAdapter -VM $VM | Select Parent,Name,NetworkName


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

The VM's name is available in the Parent property.

You can do

$VIServer = Connect-VIServer -Server VirtualCenterServer

$VM = Get-VM

Get-NetworkAdapter -VM $VM | Select Parent,Name,NetworkName


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
russjar
Enthusiast
Enthusiast
Jump to solution

That's fantastic thank you!

VCP,MCSE NT4/W2k/W2k3, MCSA W2k3
0 Kudos