drivera01
Enthusiast
Enthusiast

vm - get-NetworkAdapter

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

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

0 Kudos
2 Replies
LucD
Leadership
Leadership

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

0 Kudos
drivera01
Enthusiast
Enthusiast

thanks!!!!

0 Kudos