Nitin Pandey
asked on
Report of VMs allocated CPU & RAM and Minimum, Maximum and Average consumption over a period
Hello Team,
This script gives a great output for Memory and CPU usage average over a period of time. I was trying to get Memory and CPU Usage with Minimum & Maximum. Is there a way to do it via PowerCLI?
What I'm trying to achieve is resources allocated to VMs against their utilisation, so that I can do some right sizing to the environment.
Thanks
This script gives a great output for Memory and CPU usage average over a period of time. I was trying to get Memory and CPU Usage with Minimum & Maximum. Is there a way to do it via PowerCLI?
What I'm trying to achieve is resources allocated to VMs against their utilisation, so that I can do some right sizing to the environment.
Thanks
Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Select Name, Host, NumCpu, MemoryMB, `
@{N="CPU Usage (Average), Mhz" ; E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}}, `
@{N="Memory Usage (Average), %" ; E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , `
@{N="Network Usage (Average), KBps" ; E={[Math]::Round((($_ | Get-Stat -Stat net.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , `
@{N="Disk Usage (Average), KBps" ; E={[Math]::Round((($_ | Get-Stat -Stat disk.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} |`
Export-Csv -Path C:\temp\AverageUsage.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was trying the script with Min and Max.. It's actually Minimum and Maximum.
Thanks a lot :)
Thanks a lot :)
You are most welcome. I also corrected Host to VMHost.
ASKER
Yes Sam. Noticed that. This is a huge help to community to work on environment right sizing.
Thanks once again :)
Thanks once again :)
You are most welcome once again, :)
ASKER