I need a script to sum up all ram usage of all vm´s in a .txt file.
How can I do that?
You could do like this
(Get-VM -Name $vmNames).ExtensionData.Summary.QuickStats.GuestMemoryUsage | Measure-Object -Sum
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is that assigned memory or actually used memory, or both?
There are quite a few values for that.
This just shows some of them
Get-VM -Name $vmNames |
Select Name,MemoryGB,
@{N='MaxMemoryGB';E={$_.ExtensionData.Summary.RunTime.MAxMemoryUsage}},
@{N='GuestOSMemoryGB';E={$_.ExtensionData.Summary.QuickStats.GuestMemoryUsage}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Judging from your other thread, you seem to want to summarise the memory over all VMs.
Get-VM -Name $vmNames | Measure-Object -Property MemoryGB -Sum
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It is actual usage.
And I need to end up with one number of the total usage of ram for all vm´s (sum).
You could do like this
(Get-VM -Name $vmNames).ExtensionData.Summary.QuickStats.GuestMemoryUsage | Measure-Object -Sum
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Just what I was looking for. Thanks.