Hello
I'm starting working on new script to Get CPU Memory Network Disk Usage. I'm starting with Average and I will add the Max & Min stats.
My issue is that I'm not able to retreive ESXi name and not able to exclude vCLS from csv report.
Below is the script
Get-VM | Where-Object {$_.PowerState -eq "PoweredOn" -notcontains "vCLS"} | Select-Object 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 .\AverageUsage.csv