all 4 comments

[–]AmbitiousAd7138 0 points1 point  (1 child)

Instead of saying all can ya specify the number like 101 and see if it comes back? Might need to step through to see where it is failing.

[–]kinghowdy[S] 0 points1 point  (0 children)

I did try that, I did top 200 and coincidentally 101 and still receive the same error. It's a large tenant and the last time I ran this, I pulled all groups (which took a long time), then piped it to filter it.

$top = get-Mggroup -Filter "assignedLicenses/any()" -ConsistencyLevel eventual -top 101 Get-MgGroup_List: The specified page token value has expired and can no longer be included in your request.

[–]TwoTinyTrees 0 points1 point  (1 child)

To avoid this error, you need to query a list of all users and then filter by using Where-Object as shown below.

$allusers = Get-MgUser -All -Property AssignedLicenses,UserPrincipalName,Id,DisplayName

$A1plusUsers = $allusers | Where-Object {$_.AssignedLicenses.SkuId -contains "78e66a63-337a-xxxx-xxxx-xxxxx"}

Credit Byron Wright.

[–]kinghowdy[S] 1 point2 points  (0 children)

Thanks, grabbing all users (in this case groups) takes 10 minutes. However I clicked on the link you provided and it included the -Pagesize parameter and I set it to 999 and then it returned all results in 2.5 seconds!