Get-MgmtGraphUserCount
MgmtGraph: Audits the total number of users in the tenant
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Users
[CmdletBinding()]
Param ()
Process {
try {
$count = Get-MgUserCount -ConsistencyLevel eventual -ErrorAction Stop
$result = [PSCustomObject]@{
TotalUserCount = $count
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}This script has no configurable parameters.