Before proceed install Azure Active Directory PowerShell for Graph and run the below command to connect Azure AD PowerShell module:
Connect-AzureAD
Export Enabled Office 365 Users to CSV:
The below command lists all the enabled Azure AD users in PowerShell console.Get-AzureADUser -All $True | Where-Object { $_.AccountEnabled -eq $true } | FTYou can export user details to csv file by running below command:
Get-AzureADUser -All $True | Where-Object { $_.AccountEnabled -eq $true } | Select-Object UserPrincipalName, DisplayName, Department | Export-Csv "C:\EnabledO365Users.csv" -NoTypeInformation -Encoding UTF8
Export Disabled Office 365 Users to CSV:
Run the below command to list disabled or sign-in access blocked office 365 users in PowerShell console.Get-AzureADUser -All $True | Where-Object { $_.AccountEnabled -eq $false } | FTYou can get a list of disabled office 365 users in csv file by running below command:
Get-AzureADUser -All $True | Where-Object { $_.AccountEnabled -eq $false } | Select-Object UserPrincipalName, DisplayName, Department | Export-Csv "C:\DisabledO365Users.csv" -NoTypeInformation -Encoding UTF8
No comments:
Post a Comment