VMware Cloud Community
COS
Expert
Expert
Jump to solution

Easy points - get list of virtualportgroups that start with "dv-vm-"

I need to get a list of all virtualportgroups from vCenter but filter only for the ones prefixed by "dv-vm-" and pipe it out to a text file.

Note, I am pretty new to PowerCLI so simple works best for me...…..lol

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Like this?

Get-VirtualPortGroup -Name dv-vm-* |

Out-File -FilePath .\portgroups.txt

Or do you want to see specific properties?


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

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Like this?

Get-VirtualPortGroup -Name dv-vm-* |

Out-File -FilePath .\portgroups.txt

Or do you want to see specific properties?


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

Reply
0 Kudos
COS
Expert
Expert
Jump to solution

@LucD, Thanks!

Looks like it came with more fields than I need...…. Key, VLANID, etc....

How do I get ~just~ the name?

Sorry man, I'm a noob at PowerCLI.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

No problem, we all started with this stuff at some point :smileygrin:

Try like this

Get-VirtualPortGroup -Name dv-vm-* |

Select -ExpandProperty Name |

Out-File -FilePath .\portgroups.txt

 


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

Reply
0 Kudos