PowerCLI

 View Only
  • 1.  Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 07:04 AM

    I am trying to collect weekly performance stats for vm, however facing weird issue. Get-Stat output is returning no value for several vms when running from 2008 server, getting the stats for same vm when running from windows7 desktop.

    Tried to upgrade powercli to version 6 but still same issue.

    Powercli version is same on windows7 and 2008

    When running from 2008 server

    PowerCLI C:\r>  Get-Stat -Entity "xxxxxxx" -start (get-date).AddDays(-7) -Finish (Get-Date) -MaxSamples 100  -stat cpu.usage.average

    PowerCLI C:\>

    When running from windows 7

    PowerCLI C:\>  Get-Stat -Entity ('xxxxxx') -start ((get-date).AddDays(

    -7)) -Finish (Get-Date) -MaxSamples 1000 -stat cpu.usage.average

    MetricId                Timestamp                          Value Unit     Insta

                                                                              nce

    --------                ---------                          ----- ----     -----

    cpu.usage.average       1/29/2016 2:45:20 PM                1.33 %

    cpu.usage.average       1/29/2016 2:45:00 PM                0.85 %

    cpu.usage.average       1/29/2016 2:44:40 PM                1.04 %

    cpu.usage.average       1/29/2016 2:44:20 PM                1.56 %

    cpu.usage.average       1/29/2016 2:44:00 PM                2.23 %

    cpu.usage.average       1/29/2016 2:43:40 PM                2.23 %

    cpu.usage.average       1/29/2016 2:43:20 PM                1.17 %

    cpu.usage.average       1/29/2016 2:43:00 PM                0.94 %

    cpu.usage.average       1/29/2016 2:42:40 PM                 2.2 %

    cpu.usage.average       1/29/2016 2:42:20 PM                0.96 %



  • 2.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 07:12 AM

    Did you check that both environment have the same open connections ($global:defaultviservers)

    Are the PowerShell versions the same ? ($PSVersionTable)

    Can you take a screenshot from running the code in both environments ?

    Like this



  • 3.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 07:31 AM

    Here is screenshot on windows2008 and windows7 for same vm. I do get stats for some vms on 2008 server but not for all, however getting stats for all vms when running from windows7.

    Windows7 output



  • 4.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 08:03 AM

    Are the PowerShell versions the same on both machines ?

    You can check by displaying the content of $PSVersionTable.

    Are you using the same account on both machines ?

    Are you using the same account to connect to the vCenter on both machines ?

    The fact that you get stats for some VMs on the 2008 server seems to indicate that Get-Stat is working.

    But there might be a permission issue.



  • 5.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 12:13 PM

    Thanks for quick response.

    Powershell version is same on both machines.

    PowerCLI C:\>  $PSVersionTable.PSVersion

    Major  Minor  Build  Revision

    -----  -----  -----  --------

    4      0      -1     -1

    Logging to same VC with same account with admin rights. I am running for loop on all vms on cluster and some vms return stats other not. There is no permission error, it's really strange



  • 6.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 12:17 PM

    Can you check one more thing, what is in the variable $ErrorActionPreference on both platforms ?



  • 7.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 12:28 PM

    Value is "continue" on both platform.



  • 8.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 12:46 PM

    I'm out of ideas right now :smileyshocked:

    Any reason why you are still on this rather old PowerCLI version ?



  • 9.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 01:02 PM

    This host is running scheduled powercli script for long. I have tried to upgrade to powercli 6 but hit same issue on newer version.



  • 10.  RE: Empty output when running get-stat from 2008 server?

    Posted Jan 29, 2016 01:09 PM

    I can't reproduce your issue.

    I have a strong suspicion that it is something on that Windows 2008 server or in your environment.

    Do you have a spare Windows 2008, where you could try with a fresh PowerCLI installation ?

    Ultimately I would suggest to open a SR with VMware.