VMware Cloud Community
antoniogemelli
Hot Shot
Hot Shot
Jump to solution

get only VM with more than 1 Tb Disk Provisioned

Hello, I would like to use this script to get only VM with more than 1 Tb Disk Provisioned,

Get-VM |select Guest,NumCpu,MemoryMB,Host,UsedSpaceGB,ProvisionedSpaceGB,Name|Export-Csv -path “C:\Users\gemela\Hardware_info.csv” -NoTypeInformation

Thanks

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The question is unclear and might be interpreted in 2 ways, but if you are looking for VMs that have 1TB of storage provisioned in total vs VMs that have at least 1 harddisk with 1TB of storage provisioned,  you can use a simple Where-clause on ProvisionedSpaceGB.

Get-VM | Where-Object {$_.ProvisionedSpaceGB -ge 1024} |

select Guest,NumCpu,MemoryMB,Host,UsedSpaceGB,ProvisionedSpaceGB,Name |

Export-Csv -path “C:\Users\gemela\Hardware_info.csv” -NoTypeInformation


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

5 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The following PowerCLI script returns all of the virtual machines with at least one 1TB or larger disk:

Get-VM | Where-Object {(Get-HardDisk -VM $_).CapacityGB -ge 1024} |

select Guest,NumCpu,MemoryMB,Host,UsedSpaceGB,ProvisionedSpaceGB,Name |

Export-Csv -path “C:\Users\gemela\Hardware_info.csv” -NoTypeInformation

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
LucD
Leadership
Leadership
Jump to solution

The question is unclear and might be interpreted in 2 ways, but if you are looking for VMs that have 1TB of storage provisioned in total vs VMs that have at least 1 harddisk with 1TB of storage provisioned,  you can use a simple Where-clause on ProvisionedSpaceGB.

Get-VM | Where-Object {$_.ProvisionedSpaceGB -ge 1024} |

select Guest,NumCpu,MemoryMB,Host,UsedSpaceGB,ProvisionedSpaceGB,Name |

Export-Csv -path “C:\Users\gemela\Hardware_info.csv” -NoTypeInformation


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

antoniogemelli
Hot Shot
Hot Shot
Jump to solution

All LUN have 1 or 2 Tb in a cluster. There was one VM who provisioned 3.40 Tb (with one snapshot offline), machine usually have 900 Gb, let's say 1 Tb + snapshot. I didn't expect this size, I would like to check all machine who have more than 1 and/or 2 Tb disk provisioned to analyze.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

So, do you mean 1TB total provisioned or individual harddisks larger than 1TB?

The code I provided filters on total provisioned.

For example, a VM with a 500GB and a 600GB harddisk will be reported (total is 1.1TB)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
antoniogemelli
Hot Shot
Hot Shot
Jump to solution

It's ok LucD, It was useful, I needed to identify if there was more than one machine who provisioned (total) 1 Tb (1 Tb with all disks) Thanks a lot

Reply
0 Kudos