Is there a easy way to retrieve the datacenter information in VC such as:
Number of:
- Hosts
- Virtual Machines
- Clusters
- Networks
- Datastores
That is quit easy in PowerShell and the VITK.
Get-VMHost | Measure-Object | Select Count Get-VM | Measure-Object | Select Count Get-Cluster | Measure-Object | Select Count Get-VirtualPortGroup -VMHost (Get-VMHost -Name <ESX-hostname>) | Measure-Object | Select Count Get-Datastore | Measure-Object | Select Count
Note that you can add selection criteria in between to select specific objects.
For example, if you only want to count the VMFS datastores you could do:
Get-Datastore | Where-Object {$_.Type -eq "VMFS"} | Measure-Object | select Count
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is quit easy in PowerShell and the VITK.
Get-VMHost | Measure-Object | Select Count Get-VM | Measure-Object | Select Count Get-Cluster | Measure-Object | Select Count Get-VirtualPortGroup -VMHost (Get-VMHost -Name <ESX-hostname>) | Measure-Object | Select Count Get-Datastore | Measure-Object | Select Count
Note that you can add selection criteria in between to select specific objects.
For example, if you only want to count the VMFS datastores you could do:
Get-Datastore | Where-Object {$_.Type -eq "VMFS"} | Measure-Object | select Count
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD, man your fast, i just got it and was about to paste an answer, do a refresh and BANG !
I hope the communities are paying you for that sort of a response :smileygrin:
Alan, don't deprive us from your answer.
With your experience on reporting I'm sure you could ameliorate my rather basic reply.
PS1: it was mostly a cut & paste job from our local FAQ
PS2: with the current VMW stock prices I wouldn't dare to ask for payment
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Easy doesn't mean fast in this case. If you're enumerating all datacenters in a virtual center installation and you want the statistics to show up in a nice table, is there an easy way to get this information without making so many calls? If there were a way to do this with the SDK I'd be happy to use that and write my own function wrapper for it.
--
Poshoholic