VMware Cloud Community
VishnuN87
Contributor
Contributor

Need help with powercli script to get cluster to datacenter to vcenter mapping

Need help with powercli script to get cluster to datacenter to vcenter mapping. Have tried with get-cluster or the get-datacenter but not getting the desired output

vcenter | datacenter | cluster

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

Did you try like this?

 

Get-Cluster -PipelineVariable cluster | Get-Datacenter |
Select-Object @{N = 'vCenter'; E = { ([uri]$cluster.ExtensionData.Client.ServiceUrl).Host }},
  @{n='Datacenter';E={$_.Name}},
  @{N='Cluster';E={$cluster.Name}}

 

 


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

Reply
0 Kudos
VishnuN87
Contributor
Contributor

Thanks  Lucd , that works like a charm. But i Could see that for some vcenters it has not collected all the clusters .

Do we have a script to run RVTools for multiple vcenters  and combine the output into a single excel file ?

Reply
0 Kudos
LucD
Leadership
Leadership

To run that against multiple vCenters have a look at Solved: Re: Invoke multiple vcenters from rvtoolsbatch - VMware Technology Network VMTN

To merge all resulting XLSX files into 1 XLSX file, see powershell - How to merge multiple excel files and update the merged file's worksheet names as excel...


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