- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A quick way to find all the hosts that have a portgroup with a specific name is the following
$pgName = "MyPG"
Get-VMHost | %{
if($_ | Get-VirtualPortGroup -Name $pgName -ea SilentlyContinue){
$_.Name
}
}
Note the -ea (-ErrorAction) parameter. It avoids error messages for those host where the portgroup is not present.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference