Created
November 17, 2022 00:42
-
-
Save pcdoyle/12db8e275f4e668281fbfc031472c677 to your computer and use it in GitHub Desktop.
This command will get the Azure AD User by their UPN's domain.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-AzureADUser -All $true | ` | |
where-object {($_.UserPrincipalName -like "*@example.com") -and ($_.AccountEnabled -eq $true)} | ` | |
Select-Object -property UserPrincipalName,DisplayName,AccountEnabled | ` | |
Export-Csv -Path .\ActiveERISUsers.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add multiple domains by adding an -or to the second line: