Forum Discussion

Melbatoast's avatar
Melbatoast
Copper Contributor
May 08, 2024
Solved

Migrating from Get-AzureADUser to Get-MgUser

I am attempting to replicate a Get-AzureADUser command using Get-MgUser. The previous command (Get-AzureADUser -Top 5000 | Where-Object {($.AccountEnabled -eq "True") -and (($.CompanyName -eq "CompA"...
  • VasilMichev's avatar
    VasilMichev
    May 09, 2024
    The example above works just fine in PowerShell, too:

    Get-MgUser -Filter "companyName ne null and (companyName eq 'ZZZ' or companyName eq 'YYY')" -ConsistencyLevel eventual -CountVariable count

    Again, use consistencyLevel/count.

Resources