Forum Discussion

ddaniel's avatar
ddaniel
Icon for Staying Involved rankStaying Involved
20 days ago
Solved

I could use some help with a Powershell script for the events feed.

For some work I am doing trying to track DHCP events, I have been looking at the Events Feed API and am having trouble getting code working in Powershell.  I know my API key/Account ID are good becau...
  • JohnF's avatar
    6 days ago

    Hi ddaniel​, the first result from the API with no marker specified is always an empty result set with a marker value so I think your logic on line 196 just needs to be amended to this:

    if (($feed.fetchedCount -eq 0 -and $batchCount -ne 0) -or [string]::IsNullOrWhiteSpace($feed.marker)) {

    That way, it will skip trying to break execution for the first result set and then start using the marker until you do get a true empty result set.