3 Replies Latest reply on Aug 31, 2010 4:10 PM by phamv

    Datastore Provisioned space

    jpoling Expert

       

      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

       

       

        • 2. Re: Datastore Provisioned space
          nkange Lurker
          VMware Employees

          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

          • 3. Re: Datastore Provisioned space
            Novice

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

             

            I tried adding

             

            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)