I need a script the can read a .txt file of vm names, and sum all vm disk to one number.
Can anyone help me in that?
$vmList = Get-Content c:\temp\vmlist.txt
???
Thanks all, for guiding me in the right direction.
I got i right after some tries.
This was what I was looking fore;)
$vmNames = Get-Content -Path C:\Temp\vm.txt
Get-VM -Name $vmNames | Measure-Object -Property UsedSpaceGB -Sum
__________________________________________________________________________
Was it helpful? Let us know by completing this short survey here
.
Something like this?
Get-VM -Name $vmNames |
Select Name,UsedSpaceGB,ProvisionedSPaceGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I need all disks do be summed up to one number;)
That is what those 2 numbers represent, capacity and used.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You are right. What I want is to sum all disk usage of all the vm´s.
You could also do like this
Get-VM -Name $vmNames |
Select Name,
@{N='HDSpaceGB';E={(Get-HardDisk -VM $_ | Measure-Object -Property CapacityGB -Sum).Sum}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks all, for guiding me in the right direction.
I got i right after some tries.
This was what I was looking fore;)
$vmNames = Get-Content -Path C:\Temp\vm.txt
Get-VM -Name $vmNames | Measure-Object -Property UsedSpaceGB -Sum
__________________________________________________________________________
Was it helpful? Let us know by completing this short survey here
.