Hi
Is there a way to list the hierarchy in vCenter?
vCenter server, Datacneter, Cluster and export them to a csv file?
Thanks
My script lists the vCenter servers in the vCenter property.
It depends how deep you want the tree structure to be.
My Get the folderpath post gives you the full paths.
If you need more details, for example also list the VMs, the function can be adapted.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can list the datacenter and cluster hierarchy with:
& { foreach ($Datacenter in (Get-Datacenter)) { foreach ($Cluster in (Get-Cluster -Location $Datacenter)) { New-Object -TypeName PSObject -Property @{ vCenter = $Datacenter.Uid.Split("@")[1].Split(":")[0] Datacenter = $Datacenter.Name Cluster = $Cluster.Name } } } } | Select-Object -Property vCenter,Datacenter,Cluster | Export-Csv -Path DatacenterInfo.csv -NoTypeInformation -UseCulture
Is it possible to also list the vCenter servers?
My script lists the vCenter servers in the vCenter property.
Sorry I did see thiis after I ran the script.
Exactlly what I was looking for thanks!
HI
Can we also add the following cluster features?
Sure. The next PowerCLI script adds the HAEnabled, DrsEnabled and DrsMode properties to the output.
& { foreach ($Datacenter in (Get-Datacenter)) { foreach ($Cluster in (Get-Cluster -Location $Datacenter)) { New-Object -TypeName PSObject -Property @{ vCenter = $Datacenter.Uid.Split("@")[1].Split(":")[0] Datacenter = $Datacenter.Name Cluster = $Cluster.Name HAEnabled = $Cluster.HAEnabled DrsEnabled = $Cluster.DrsEnabled DrsMode = $Cluster.DrsMode } } } } | Select-Object -Property vCenter,Datacenter,Cluster,HAEnabled,DrsEnabled,DrsMode | Export-Csv -Path DatacenterInfo.csv -NoTypeInformation -UseCulture
Perfect. Thanks!