Hello Guys,
I know I am a little bit late to the party, I am just learning PowerCLI and automating as much as I can. My need is to export hosts and clusters ESXIs full path like below:
vCenter1
Datacenter1
Europe/host1
Africa/host1
Africa/host2
Aisa/host1
America/host1
Datacenter2
Australia/host1
New Zealand/host1
New Zealand/host2
So basically I need command to export to excel the output like:
datacenter1/Europe/host1
datacenter1/Africa/host1
datacenter1/Africa/host2
datacenter1/Aisa/host1
datacenter1/America/host1
datacenter2/Australia/host1
datacenter2/New Zealand/host1
datacenter2/New Zealand/host2
I have been trying with Get-View and Get-VMHost but nothing seem to return what I am looking for.
You might want to have a look at my Get-InventoryPlus function in Get-InventoryPlus – Inventory Of All VSphere Objects.
With that function, you could do
where { $_.Type -eq 'HostSystem' } |
Select Name, Path |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Sure I will and will get back to you with positive feedback... Thanks for your quick help.