Hi guys,
I am trying to create an inventory of all the ESX hosts and build numbers for my vCenter.
I am trying to have the output in the below format in an excel spreadsheet.
datacenter
I
I------>Cluster
I
I------->hosts name and build numbers
I have tried several times to get this format without any joy. Any help on how to start this to get this output would be great.
Thanks
Dougie
Hi Dougie,
the next PowerCLI will create the desired report and will put the information in a .csv file called ESXinventory.csv. If you open this file in Excel, it will have the layout you want.
Get-Datacenter | ` Sort-Object -Property Name | ` ForEach-Object { $Datacenter = $_ $Report = "" | Select-Object Datacenter, Cluster, VMHost, Build $Report.Datacenter = $Datacenter.Name $Report $Datacenter | ` Get-Cluster | ` Sort-Object -Property Name | ` ForEach-Object { $Cluster = $_ $Report = "" | Select-Object Datacenter, Cluster, VMHost, Build $Report.Cluster = $Cluster.Name $Report $Cluster | ` Get-VMHost | ` Sort-Object -Property Name | ` ForEach-Object { $VMHost = $_ $Report = "" | Select-Object Datacenter, Cluster, VMHost, Build $Report.VMHost = $VMHost.Name $Report.Build = $VMHost.Build $Report } } } | Export-Csv -Path ESXinventory.csv -NoTypeInformation -UseCulture
Regards, Robert
Hi Dougie,
the next PowerCLI will create the desired report and will put the information in a .csv file called ESXinventory.csv. If you open this file in Excel, it will have the layout you want.
Get-Datacenter | ` Sort-Object -Property Name | ` ForEach-Object { $Datacenter = $_ $Report = "" | Select-Object Datacenter, Cluster, VMHost, Build $Report.Datacenter = $Datacenter.Name $Report $Datacenter | ` Get-Cluster | ` Sort-Object -Property Name | ` ForEach-Object { $Cluster = $_ $Report = "" | Select-Object Datacenter, Cluster, VMHost, Build $Report.Cluster = $Cluster.Name $Report $Cluster | ` Get-VMHost | ` Sort-Object -Property Name | ` ForEach-Object { $VMHost = $_ $Report = "" | Select-Object Datacenter, Cluster, VMHost, Build $Report.VMHost = $VMHost.Name $Report.Build = $VMHost.Build $Report } } } | Export-Csv -Path ESXinventory.csv -NoTypeInformation -UseCulture
Regards, Robert
Thats great thanks.
It looks to logical when you see it done, but just could figure how to do it.
Thanks
Dougie