0

when I am getting statistics from ESXi using vmware powercli on windows7 it gives me responce Wondows7 command: PowerCLI C:\temp>

Get-VMHost -Name "hostname.inc.com" | Get-Stat -Stat
 cpu.usage.average  -Start (Get-Date).AddDays(-1) -Finish(Get-Date) -MaxSamples 100

returns output

MetricId                Timestamp                          Value Unit     Insta
                                                                          nce
--------                ---------                          ----- ----     -----
cpu.usage.average       31.10.2013 15:40:00                25,03 %
cpu.usage.average       31.10.2013 15:35:00                22,95 %
cpu.usage.average       31.10.2013 15:30:00                23,97 %
...

when from Windows2008r2 command: PowerCLI C:\temp>

Get-VMHost -Name "hostname.inc.com" | Get-Stat -Stat
 cpu.usage.average  -Start (Get-Date).AddDays(-1) -Finish(Get-Date) -MaxSamples 100

returns "nothing"

Interesting- if run on windows2008r2 command: PowerCLI C:\temp>

Get-VMHost -Name "hostname.inc.com" | Get-Stat -Stat
 cpu.usage.average  -Realtime -MaxSamples 100

it gives responce

cpu.usage.average       10/31/2013 9:49:40 AM               9.77 %        30
cpu.usage.average       10/31/2013 9:49:20 AM               8.63 %        30
cpu.usage.average       10/31/2013 9:49:00 AM              12.05 %        30
cpu.usage.average       10/31/2013 9:48:40 AM               11.5 %        30
cpu.usage.average       10/31/2013 9:48:20 AM              14.25 %        30
cpu.usage.average       10/31/2013 9:48:00 AM              11.02 %        30
cpu.usage.average       10/31/2013 9:47:40 AM              11.77 %        30
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52

1 Answers1

0

Perhaps your version of Powershell on the Windows 7 box is handling your syntax error to do with the lack of space in the line -Finish(Get-Date) (it should be -Finish (Get-Date)) - whereas the Powershell version on the Windows 2008 R2 box does not handle the error. So when you remove the -Start and -Finish switches, you are removing the syntax error to do with -Finish.

It should be:

Get-VMHost -Name "hostname.inc.com" | Get-Stat -Stat cpu.usage.average -Start (GetDate).AddDays(-1) -Finish (Get-Date) -MaxSamples 100
unclemeat
  • 5,029
  • 5
  • 28
  • 52