How do I get Provisioned information from Datastores using Powershell

Posted on 2011-04-21
Last Modified: 2012-05-11
I have two main VMware environments, back-end and customer facing and I have vKernel monitoring on the customer facing environment. Each day I get a cool report, Capacity Monitor Datastore Statistics Report, which gives me some useful information (total space, allocated space, free space, commited %, utilized %). My experience with powershell is related to Exchange and not VMware so all the commands available are new and I am just learning them. So far I have not found a way to get this same type of information (very useful with thin provisioned disks) using powershell.
I see that get-datastore will give me some of the information but nothing related to the ‘over’ allocated space of each datastore (i.e. 2 TB lun with 2.7 TB allocated and 750 GB free). I am hoping someone here can point me in the direction to where I can find this information/command(s) in powershell? Thank you for your time.
Question by:exsuprt
    LVL 116

    Accepted Solution

    this script is from our toolbox, for find thin provisioned disks, i'm sure it could be adapted with enough time, using datastore sizes etc

    # DisplayThinnies.ps1
    # Displays Virtual Machines and templates that are using thin-provisioned "thin and crispies" virtual disks.
    $vmtp = Get-VM
    $vmtp += Get-Template
    foreach($vm in $vmtp | Get-View){
      foreach($dev in $vm.Config.Hardware.Device){
        if(($dev.GetType()).Name -eq "VirtualDisk"){
          if($dev.Backing.ThinProvisioned -eq $true) {
            $vm.Name + "`t" + $dev.Backing.FileName

    Open in new window


    Author Comment

    Thank you for your response, I always appreciate people sharing the scripts they spend time on creating.

    I am still curious if you or anyone might know the command(s) I would need to use to get those provisioned sizes of the datastores.  I've done searches using all the search criteria I can think of and have no luck so far in finding anything useful.  VMware's site isn't quite as useful as I had hoped when it comes to the powershell commands.

    Again, thanks...

    Author Comment

    Ok, I have another thought on how to get this information.

    Is there a way I can get the Allocated (Provisioned) space per VM?
    LVL 116

    Expert Comment

    by:Andrew Hancock (VMware vExpert / EE MVE)
    Have you looked at the The VMware Community PowerPack

    This has VM Guest Disk sizes, and if this isn't in your VMware Toolbox it should be!

    and also VMware Labs VMwarte Guest Console

    (another one for the Toolbox!)
    LVL 116

    Expert Comment

    by:Andrew Hancock (VMware vExpert / EE MVE)
    this is the missing URL for VGC

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Using a software based iSCSI solution, there is no requirement to purchase a hardware iSCSI initiator or TOE (TCP/IP Offload Engine) interface card. A standard network interface card can be used to connect an existing ESXi server to a remote iSCSI t…
    Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
    Teach the user how to convert virtaul disk file formats and how to rename virtual machine files on datastores. Open vSphere Web Client: Review VM disk settings: Migrate VM to new datastore with a thick provisioned (lazy zeroed) disk format: Rename a…
    This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now