Hi All,
I have a list of VMs which are thick provisioned, i am looking for the script which can give me free space for the given VMs.
I want to show the VMs list and get those VMs free space. something like get-content (my VM list)
Thanks in Advance.
Not sure how your file looks, but if it is a file with just the names, you could do
Get-VM -Name (Get-Content -Path names.txt) | Get-VMGuest |
Select VmName,
@{N='FreeSpaceGB';E={"{0:N1}" -f ($_.Disks | Measure-Object -Property FreeSpaceGB -Sum | select -ExpandProperty Sum)}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Something like this ?
Get-VM | Get-VMGuest |
Select VmName,
@{N='FreeSpaceGB';E={"{0:N1}" -f ($_.Disks | Measure-Object -Property FreeSpaceGB -Sum | select -ExpandProperty Sum)}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD for reply.
I have list of VMs , need to get free space for those VMs only. something like i will save those VM names in csv or text.
Not sure how your file looks, but if it is a file with just the names, you could do
Get-VM -Name (Get-Content -Path names.txt) | Get-VMGuest |
Select VmName,
@{N='FreeSpaceGB';E={"{0:N1}" -f ($_.Disks | Measure-Object -Property FreeSpaceGB -Sum | select -ExpandProperty Sum)}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD,
This script was use full for me.
