VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Cluster Name shows blank

Hi,

I am not able to get the cluster name from the below script, please help

Get-VMHost | Get-VirtualPortGroup -Name "VM Network 3011" | select @{N='Cluster';E={get-cluster -Name $_}}, @{N='VMHost';E={get-vmhost -id $_.VMhostid}}, @{N='PortGroup_Name';E={$_.Name}}, VirtualSwitch, VLanID

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this.
It requires PS v4 or higher.

Get-VMHost -PipelineVariable esx | Get-VirtualPortGroup -Name "VM Network 3011" |

select @{N='Cluster';E={(Get-Cluster -VMHost $esx).Name}},

   @{N='VMHost';E={$esx.Name}},

   @{N='PortGroup_Name';E={$_.Name}},

  VirtualSwitch, VLanID

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


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

Try like this.
It requires PS v4 or higher.

Get-VMHost -PipelineVariable esx | Get-VirtualPortGroup -Name "VM Network 3011" |

select @{N='Cluster';E={(Get-Cluster -VMHost $esx).Name}},

   @{N='VMHost';E={$esx.Name}},

   @{N='PortGroup_Name';E={$_.Name}},

  VirtualSwitch, VLanID

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


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

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

That was quick, Thank you very much Smiley Happy

Reply
0 Kudos