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
Hi,
View Virtual Machine Storage Resources
ARomeo
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
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