VMware Cloud Community
ief
Contributor
Contributor
Jump to solution

Datacenter information

Is there a easy way to retrieve the datacenter information in VC such as:

Number of:

- Hosts

- Virtual Machines

- Clusters

- Networks

- Datastores

blog www.ivobeerens.nl
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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:

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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 Smiley Wink


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

0 Kudos
Poshoholic
Contributor
Contributor
Jump to solution

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.

--

Kirk Munro

Poshoholic

http://poshoholic.com

Kirk Munro [MVP] Poshoholic http://poshoholic.com
0 Kudos