VMware Cloud Community
dsmith2
Contributor
Contributor

Windows Server Logical Disk Free Space via VM Tools

I am looking for a way to script a report in powershell to tell me the free disk space of the logical drives without having any kind of administrator rights on the virtual windows server. Is there a way to obtain this information via the VM Tools and have it report it to vCenter where I can obtain this information and add it to my report.

I have found some information from other resources but they use a WMI query which I would have to connect to the server with administrator rights in order to get this information.

Douglas P. Smith
0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership

The next script uses the VMware Tools to get the guests disk information:

Get-VM | `
  Where-Object { $_.PowerState -eq "PoweredOn" } | `
  Get-VMGuest | `
  ForEach-Object {
    $VmName =$_.VmName
    If ($_.Disks) { $_.Disks | `
      Add-Member -membertype NoteProperty -name VmName -Value $VmName -Passthru
    }
  }

Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos