VMware Cloud Community
drivera01
Enthusiast
Enthusiast
Jump to solution

vm - get-NetworkAdapter

How can I modify this to only show me vm's on specific NetworkNames?

This little script gives me the vms on all vlans.

eg: vlan564,vlan566,vlan567

get-cluster MYCLUSTER  |Get-VM | Get-NetworkAdapter | Where-Object { $_.ConnectionState.Connected} | Select-Object -property Parent,Name,NetworkName |ft -autosize

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can add a condition to the Where clause.

Something like this

get-cluster MyCluster  | 
Get-VM | Get-NetworkAdapter | Where-Object { $_.ConnectionState.Connected -and $_.NetworkName -eq "vlan564"} | Select-Object -property Parent,Name,NetworkName |
ft
-autosize


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You can add a condition to the Where clause.

Something like this

get-cluster MyCluster  | 
Get-VM | Get-NetworkAdapter | Where-Object { $_.ConnectionState.Connected -and $_.NetworkName -eq "vlan564"} | Select-Object -property Parent,Name,NetworkName |
ft
-autosize


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

Reply
0 Kudos
drivera01
Enthusiast
Enthusiast
Jump to solution

thanks!!!!

Reply
0 Kudos