Skip navigation
VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
2,882 Views 3 Replies Last post: Aug 31, 2010 4:10 PM by phamv RSS
jpoling Expert 507 posts since
May 25, 2004
Currently Being Moderated

Mar 19, 2010 6:18 AM

Datastore Provisioned space

 

Is there a way with powershell to grab the provisioned space for a datastore? I would like to have a quick script that lists the datastore capacity, providioned space, and free space.

 

 

I know I can get freespace and capacity (get-datastore <datastore> | select FreeSpaceMB, CapacityMB), but I am not sure about the provisioned space.

 

 

 

 

 

Thanks for any insight.

 

 

 

 

 

jeff

 

 

LucD Guru User Moderators vExpert 9,015 posts since
Oct 31, 2005
Currently Being Moderated
1. Mar 19, 2010 6:24 AM in response to: jpoling
Re: Datastore Provisioned space
Blog: http://lucd.info | Twitter: @LucD22 | Book co-author: http://powerclibook.com
nkange Lurker 2 posts since
Mar 23, 2007
Currently Being Moderated
2. Apr 8, 2010 4:40 AM in response to: jpoling
Re: Datastore Provisioned space

You can actually do that in a simple way...

 

To calculate the provisioned space value that is displayed in the summary for a datastore do this:

 

 

$ds = Get-Datastore | Get-View

$ds | Select -ExpandProperty Summary | Select Name, Capacity, FreeSpace, @{N="Provisioned"; E={ ($_.Capacity - $_.FreeSpace + $_.Uncommitted) }}

 

Make sure that you refresh storage information before doing this, you could trigger that by doing

$ds | % { $_.RefreshDatastoreStorageInfo() }

 

Hope that helps

phamv Novice VMware Employees 18 posts since
Jun 24, 2009
Currently Being Moderated
3. Aug 31, 2010 4:10 PM in response to: nkange
Re: Datastore Provisioned space

That is pretty handy.. but how do I output the $ds objects to csv?

 

I tried adding

 

Re: Datastore Provisioned space C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> $ds | select -Expandproperty Summa

ry | select Name, Capacity, FreeSpace, @{N="Provisioned";E={($_.Capacity - $_.FreeSpace + $_.Uncommited) }} |

*export-csv "c:\temp\mw-datastore.csv -notypeinformation

 

--never mind .. figured it out.

 

| export-csv c:\temp\mwdata.csv -notypeinformation

 

BUT  I don't think this shows the total amount of space allocated provisioned per vm added together on the datastore.

 

 

What can you use to determine this information

Used

Allocated

Capacity

 

like this chart:

 

 

or this chart (capacity section of the datastore summary tab that shows total provisioned space — the maximum potential growth of all virtual machines if thin provisioned disks were fully utilized)

 

Bookmarked By (0)

Share This Page

Communities