VMware Cloud Community
fborges555
Enthusiast
Enthusiast

Datastore and vm spaces

Hi gurus

I am looking to get the following information from a datastore, I need to know the VM on the datastore and what space each VM is using on the datastore

I would like to know how much space a vm is consuming on a particular datastore, is this posible.

Thanks

0 Kudos
3 Replies
Alex_Romeo
Leadership
Leadership

Hi,

View Virtual Machine Storage Resources

Procedure

  1. Browse to the virtual machine.
  2. Double-click the virtual machine and click the Summary tab.
  3. Review the storage use information in the upper right area of the Summary tab.

ARomeo

Blog: https://www.aleadmin.it/
0 Kudos
fborges555
Enthusiast
Enthusiast

A.

Thanks for jumping in, I am looking to get all the info from a datastore and vm at once using powercli , your steps helps me one vm at a time.

Thanks

0 Kudos
LucD
Leadership
Leadership

You could try something like this

Get-Datastore -PipelineVariable ds |

ForEach-Object -Process {

Get-VM -Datastore $ds | where{$_.ExtensionData.Storage.PerDatastoreUsage.Datastore -contains $ds.Id} |

Select @{N='Datastore';E={$ds.Name}},

    @{N='VM';E={$_.Name}},

    @{N='SpaceMB';E={[math]::Round(($_.ExtensionData.LayoutEx.File | where{$_.Name -match $ds.Name} | Measure-Object -Property Size -Sum).Sum/1MB,2)}}

} | Sort-Object -Property Datastore,VM


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

0 Kudos