PowerCLI

 View Only
  • 1.  Get-Stat and -Finish parameter for PowerCLI 13.1/13.2

    Posted Jan 09, 2024 09:06 AM

    It appears that there might be an issue with the -Finish parameter of the Get-Stat cmdlet in PowerCLI version 13.1/13.2. Upon transitioning to PowerCLI 13.1 (also tested with 13.2.1) on one of our management servers, our vSphere environment performance monitoring code ceased to function properly.

    Upon debugging, it became evident that the Get-Stat cmdlet fails to return any results when the -Finish parameter is utilized. While omitting the -Finish parameter does yield correct results, it hinders our ability to narrow down the observation period as needed.

    The following code performs flawlessly under PowerCLI 12.2.0 and 13.0.0 (validated by reverting to the previous versions), yet yields no results under PowerCLI 13.1.0/13.2.1.

    We've observed that the Release Notes for PowerCLI 13.1.0 include the following information:
    "The performance of the Get-Stat cmdlet has been improved for the instances when you use the Start parameter."

    Considering this, we wonder if there might be a connection between this enhancement and the unexpected behavior we are currently experiencing. Any insights or suggestions on this matter would be greatly appreciated.

    ### CODE 

    $VMStatParameters = "mem.usage.average"
    $entity = get-vm $vmName | Where-Object {($_.PowerState -eq "PoweredOn")}
    $startDate = "01/12/2023"
    $endDate = "01/01/2024"

    Get-Stat -Entity $entity -Stat $VMStatParameters -Start $startDate -Finish $endDate



  • 2.  RE: Get-Stat and -Finish parameter for PowerCLI 13.1/13.2

    Posted Jan 09, 2024 09:20 AM

    I can confirm that behavior.

    Open an SR.
    If GSS claims that PowerCLI is not supported or that you need a Developer Support contract, point them to the PowerCLI support policy: https://developer.vmware.com/docs/15315/GUID-0F835722-E667-4177-A8EF-51AB15FA837E.html.



  • 3.  RE: Get-Stat and -Finish parameter for PowerCLI 13.1/13.2

    Posted Jan 09, 2024 05:22 PM

    Many thank you for the prompt reply.

    I opened a Service Request (reference 24491487301) under our VMware account.

    Let's see how it goes.



  • 4.  RE: Get-Stat and -Finish parameter for PowerCLI 13.1/13.2

    Posted Jan 09, 2024 05:30 PM

    I contacted someone from the PowerCLI Dev team, they are aware of the issue.



  • 5.  RE: Get-Stat and -Finish parameter for PowerCLI 13.1/13.2

    Broadcom Employee
    Posted Feb 06, 2024 02:17 PM

    Hello, we managed to isolate and fix the problem. It's caused by the fact that since PowerCLI 13.1 we depend on the server to filter the stats by start and finish date. When start/finish is specified the server does not return stats for all intervals (sampling periods). When IntervalMins/IntervalSecs is not specified, there's custom client side logic, that selects most appropriate interval. For workaround until the fix is available, you can explicitly specify interval, for which stats are available, f.e.

    Get-Stat -Entity $entity -Stat $VMStatParameters -Start $startDate -Finish $endDate -IntervalMins 60