VMware Cloud Community
ssauer
Contributor
Contributor
Jump to solution

query for top thin disk vm candidates

I am looking for some help on a way I can query VC to find VM's that are "wasting a lot of disk" and would be good candidates for migrating to a thin disk. Is there a way to query the vm disk, and what is being consumed and what is being allocated?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
alanrenouf
VMware Employee
VMware Employee
Jump to solution

There is a nice one-liner to get the VM disk details o my blog here:

http://www.virtu-al.net/2009/03/25/vi-toolkit-one-liner-vm-guest-disk-sizes/

The script is:

ForEach ($VM in (Get-VM |Get-View)){($VM.Guest.Disk |Select @{N=“Name“;E={$VM.Name}},DiskPath, @{N=“Capacity(MB)“;E={[math]::Round($_.Capacity/ 1MB)}}, @{N=“Free Space(MB)“;E={[math]::Round($_.FreeSpace / 1MB)}}, @{N=“Free Space %“;E={[math]::Round(((100 * ($_.FreeSpace))/ ($_.Capacity)),0)}}) | Format-Table}

If you found this information useful, please consider awarding points for Correct or Helpful.

Alan Renouf

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com

View solution in original post

0 Kudos
3 Replies
NedeianuV
Enthusiast
Enthusiast
Jump to solution

Hello,

some time ago i found this script in the forums that i think it's just what you need; unfortunatelly i don't remember who wrote it.

please find the script attached.

MCP,VCP

NedeianuV MCP,VCP
alanrenouf
VMware Employee
VMware Employee
Jump to solution

There is a nice one-liner to get the VM disk details o my blog here:

http://www.virtu-al.net/2009/03/25/vi-toolkit-one-liner-vm-guest-disk-sizes/

The script is:

ForEach ($VM in (Get-VM |Get-View)){($VM.Guest.Disk |Select @{N=“Name“;E={$VM.Name}},DiskPath, @{N=“Capacity(MB)“;E={[math]::Round($_.Capacity/ 1MB)}}, @{N=“Free Space(MB)“;E={[math]::Round($_.FreeSpace / 1MB)}}, @{N=“Free Space %“;E={[math]::Round(((100 * ($_.FreeSpace))/ ($_.Capacity)),0)}}) | Format-Table}

If you found this information useful, please consider awarding points for Correct or Helpful.

Alan Renouf

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
ssauer
Contributor
Contributor
Jump to solution

Had issues with the PS script, but the one liner worked great! Thanks guys.

0 Kudos