VMware Cloud Community
PMPM789
Enthusiast
Enthusiast
Jump to solution

how to find few VMs size details in vCenter

Hi

I do have 70+ VMs . how can i see their sizes through power cli or cli . Its not all the VMs .Its particular VMs list in Vcenter . is there way can run in power cli.ps file.sorry i am not femilier with powershell 

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this then

Get-VM -Name (Get-Content -Path .\vmnames.txt) |

Select-Object Name,

   @{N="HardDiskSizeGB"; E={(Get-HardDisk -VM $_ | Measure-Object -Sum CapacityGB).Sum}}

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


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

View solution in original post

0 Kudos
10 Replies
LucD
Leadership
Leadership
Jump to solution

What do you mean by "their sizes"?
Memory, storage space...?


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

0 Kudos
PMPM789
Enthusiast
Enthusiast
Jump to solution

their storage(size of vm)

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Like this you mean?

Get-VM | Select Name,ProvisionedSpaceGB


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

0 Kudos
PMPM789
Enthusiast
Enthusiast
Jump to solution

Get-VM | Select-Object Name,@{n="HardDiskSizeGB"; e={(Get-HardDisk -VM $_ | Measure-Object -Sum CapacityGB).Sum}}

this giving all the VMs in the vCenter. I dont want that. I have few VMs in the note pad. I just need size of them

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this then

Get-VM -Name (Get-Content -Path .\vmnames.txt) |

Select-Object Name,

   @{N="HardDiskSizeGB"; E={(Get-HardDisk -VM $_ | Measure-Object -Sum CapacityGB).Sum}}

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


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

0 Kudos
PMPM789
Enthusiast
Enthusiast
Jump to solution

It worked .Thanks alot Lucd. u made my day.Thanks alot

0 Kudos
PMPM789
Enthusiast
Enthusiast
Jump to solution

Also could you please help me with this

i want to get the same script run for 5 vCenters(seperate,not linkedmode) at a time . how can i do that. till now i have run in each vcenter and took the info.but just wanna check if we can run all vCenters at a time and export at a time. Appreciate for your time .

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could run through the vCenters in a ForEach loop, and collect all the results in 1 file.
Is that feasible?


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

0 Kudos
PMPM789
Enthusiast
Enthusiast
Jump to solution

got it and its collecting the data. But the complete VM name is not coming .In the text there is full name. In the output its xyx..... is coming.Its not coming full name of VM

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is most probably because the line doesn't fit on the screen.
Try piping the result to Format-List


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