VMware Cloud Community
jasoncain_22
Enthusiast
Enthusiast

Get list of VMs that have VXlan attached or portgroup with vxlan in the name and include VM name in output

All

I am looking for something to collect this info per vCenter but if this is not possible, per cluster or datacenter works too.

I tried this and thought I had it until... I opened the output and tried to correlate back to a VM. The VM was not included.

Get-VM | Get-VirtualPortGroup |export-csv -notypeinformation c:\temp$filename

thanks!

Jason C.

*I give credit for helpful responses!!!

Tags (1)
3 Replies
gopanaboena
Enthusiast
Enthusiast

Hi

Try this

Get-VirtualPortGroup - VM * |export-csv -notypeinformation c:\temp$filename

Venkat

0 Kudos
LucD
Leadership
Leadership

Try like this

$tgtPg = 'VxLAN'

Get-VM |

where{Get-VirtualPortGroup -VM $_ -Name $tgtPg -ErrorAction SilentlyContinue} |

Select Name,@{N='Portgroup';E={$tgtPG}} |

Export-Csv report.csv -NoTypeInformation -UseCulture


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

tonto_22
Contributor
Contributor

This worked to find the specific word we use for "virtualwires" in the name of the portgroup.

Thanks.

0 Kudos