3 Replies Latest reply on May 19, 2019 11:00 AM by LucD

    How can I get more than 1000 results from TaskManager Collector?

    RonRosenkoetter Novice

      $DateStart = (Get-Date).AddDays(-1)

       

      $TaskNumber = 1000   #1000 max how to fix this?

      $TaskMgr = Get-view TaskManager

       

      $tFilter = New-Object VMware.Vim.TaskFilterSpec

      $tFilter.Time = New-Object VMware.Vim.TaskFilterSpecByTime

      $tFilter.Time.beginTime = $DateStart

      $tFilter.Time.timeType = "startedTime"

       

      $tCollector = Get-View ($taskMgr.CreateCollectorForTasks($tFilter))

       

      $dummy = $tCollector.RewindCollector

      $Tasks = $tCollector.ReadNextTasks($TaskNumber)

       

       

        foreach ($Task in $Tasks)

        {

          $TaskName = $Task.Name

          $TaskName

        }

       

       

      If I make $TaskNumber =1001 or greater, I get the following error

       

      Exception calling "ReadNextTasks" with "1" argument(s): "A specified parameter was not correct: maxCount"

      At C:\scripts\Powershell\VMware\vCenter\GetSnapshotTasks.ps1:120 char:1

      + $Tasks = $tCollector.ReadNextTasks($TaskNumber)