Skip to content

Instantly share code, notes, and snippets.

@mozziemozz
Last active March 22, 2023 23:18
Show Gist options
  • Select an option

  • Save mozziemozz/070c44a49274159f66c8b42fb3a2bbf1 to your computer and use it in GitHub Desktop.

Select an option

Save mozziemozz/070c44a49274159f66c8b42fb3a2bbf1 to your computer and use it in GitHub Desktop.
$allPages = @()
$aadUsers = (Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/users?`$top=5" -Headers $Header -Method Get -ContentType "application/json")
$allPages += $aadUsers.value
if ($aadUsers.'@odata.nextLink') {
do {
$aadUsers = (Invoke-RestMethod -Uri $aadUsers.'@odata.nextLink' -Headers $Header -Method Get -ContentType "application/json")
$allPages += $aadUsers.value
} until (
!$aadUsers.'@odata.nextLink'
)
}
$aadUsers = $allPages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment