MariusRoma
Expert
Expert

Gwetting a list of all the VMs and the used space

Jump to solution


I apologize for my very basic question.

I need to produce a file (better if an Excel file) with the list of all the VMs in a simple vSphere 5.x infrastructure including 2 VMare ESXi 5.x servers and the disk space used (not allocated, just used) by each VM.

The simplest way looks to list the VMs from the vSphere client and export the list as an .xls file.

It looks simple, but when I look at the file I see either a lot of VMs missing and/or a lot of values missing for many VMs (just blank cells).

Is it a problem related to my vSphere client?

I attempted to create a PowerCli script using the "Get-VM | select-object Name" command, but my limited skill don't let me extract the used space value.

Can anybody please provide a PowerCli sample I can just copy and use?

Is there any other way to get the information I need?

Regards

marius

.

0 Kudos
1 Solution

Accepted Solutions
homerzzz
Hot Shot
Hot Shot

Not knowing if you have setup a cluster or just standalone hosts, here is a simple one liner...

Get-VMHost -Name <ESXi hostname> | get-vm | select name,usedspaceGB

From here, you can do some formatting, get total usage etc.

View solution in original post

0 Kudos
3 Replies
homerzzz
Hot Shot
Hot Shot

Not knowing if you have setup a cluster or just standalone hosts, here is a simple one liner...

Get-VMHost -Name <ESXi hostname> | get-vm | select name,usedspaceGB

From here, you can do some formatting, get total usage etc.

View solution in original post

0 Kudos
MariusRoma
Expert
Expert

Great!!!!

In Italian we say "Appetite comes with eating"...

Can I get the datastore name, the folder name and the allocated space as well?

Even better, where can I locate a list of values I can get?

Thank you in advance

marius

0 Kudos
homerzzz
Hot Shot
Hot Shot

To look at the values that are available on a vm object...get-vm -Name <vmname> | get-view

For example,

$vm = Get-VM -name <vm name> | Get-View

$vm.Storage.PerDatastoreUsage

provides this output:

Datastore   : <Datastore Name>
Committed   : 39015129982
Uncommitted : 59726761984
Unshared    : 39015129982
LinkedView  :
DynamicType :

DynamicProperty :

There are a lot of values per object available to drill into. Explore!