Skip to content

Commit

Permalink
Fix counting error when sessions have one result.
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-counteractive committed Dec 16, 2020
1 parent 8abad80 commit 6f4b91e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
archive/
tmp/
5 changes: 4 additions & 1 deletion Get-UnifiedAuditLog.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ Submit issues, contribute, and view the license at https://github.com/counteract
$intervalResultCount = $SESSION_SIZE_LIMIT
}

$sessionResultCount = $sessionResultCount + $results.Count
$resultsCount = 1 # if there's only one result then $results is not an array (and thus won't have a .Count property)
if ($results.Count) { $resultsCount = $results.Count }
$sessionResultCount = $sessionResultCount + $resultsCount

Write-Verbose " Retrieved $([math]::Max($sessionResultCount, 0)) of $intervalResultCount interval records"

# The interesting stuff is in the AuditData field, which is a JSON string (!).
Expand Down

0 comments on commit 6f4b91e

Please sign in to comment.