Office 365: How to Find All Disabled users using PowerShell?
Requirement: Find All Disabled users in Microsoft 365.
How to Find Disabled user Accounts in Office 365?
Are you looking for a way to find all disabled users in your Office 365 environment? Or the sign-in status of a specific user to see if it’s blocked? When a user is disabled, their account can no longer access any Office 365 services. This can lead to confusion and frustration if you don’t know how to quickly identify who is active and who isn’t.
Fortunately, there are some easy steps you can take to find disabled users in Office 365. Finding all disabled users in Office 365 can be useful for various reasons, such as identifying inactive accounts that may need to be removed or reviewing the status of user accounts in your organization. In this blog post, we’ll go over how you can quickly find disabled users in Office 365.
Table of contents
- View All Disabled User Accounts in Microsoft 365 Admin Center
- Check if a specific user account is disabled in Microsoft 365
- Get if “Sign in” is blocked for a user using the Azure Active Directory admin center
- Export Disabled Users in Office 365 to a CSV file
- Get All Disabled Users in Microsoft 365 using PowerShell
- PowerShell to Find All Disabled Users in Office 365
- Get the Sign-in Disabled Status of a Particular user using PowerShell
View All Disabled User Accounts in Microsoft 365 Admin Center
To check if a user account is disabled in Office 365, use the Microsoft 365 admin center. Here is how:
Step 1: Sign in to the Microsoft 365 admin center
To access the Microsoft 365 admin center, open a web browser and go to the following URL: https://admin.microsoft.com/. Enter your Microsoft 365 administrator username and password to sign in.
Step 2: Access the “Users” tab
Once you are signed in, click on the “Users” tab in the left navigation panel. This will open the “Active users” page, which lists all of the active user accounts in your organization.
Step 3: Filter for disabled users
To find disabled users, use the Filter at the top of the page and select “Sign-in Blocked”. This will filter the list of users to only show disabled accounts.
Check if a specific user account is disabled in Microsoft 365
To check if a user account is disabled in Office 365, you can follow these steps:
- Sign in to the Microsoft 365 admin center with your administrator account.
- Expand the “Users” tab in the left navigation panel >> Click on the “Active users” tab.
- Use the search bar to search for the user’s name or email address.
- If the user’s account is disabled, it will be listed with the status of “Sign-in Blocked”.
Get if “Sign in” is blocked for a user using the Azure Active Directory admin center
Here is how you can check if a user account is disabled in Azure Active Directory (Azure AD) or Microsoft 365 using the Azure portal:
- Sign in to the Azure portal as a global administrator or user administrator at https://aad.portal.azure.com/
- In the left menu, select Azure Active Directory.
- In the Azure Active Directory blade, select Users.
- Find the user you want to check the status for and look for the “Account Status” property. If it is set to “Disabled”, the account is disabled.
Export Disabled Users in Office 365 to a CSV file
To export disabled users in Office 365 to a CSV file, you can use the following steps:
- Open the Azure AD Admin center in your web browser.
- In the left navigation panel, click on the “Users” tab.
- Click on “Add filter” and choose “Account enabled” to “No” and apply the Filter. This lists all user accounts that are disabled.
- Now, you can export the disabled users data by clicking on the “Download users” button.
This saves the exported data into a CSV file to your computer.
Get All Disabled Users in Microsoft 365 using PowerShell
To find all disabled users in Microsoft 365 (formerly known as Office 365) using the Get-AzureADUser
cmdlet from the Azure Active Directory (Azure AD) PowerShell module, you can use the -Filter
parameter to filter the results by the AccountEnabled
property. Make sure you have the Azure AD PowerShell module installed before executing this cmdlet.
PowerShell to Find All Disabled Users in Office 365
Here is an example of how you can do this:
# Import the Azure AD module
Import-Module AzureAD
# Connect to Azure AD
Connect-AzureAD
# Get all disabled users
$DisabledUsers = Get-AzureADUser -Filter "AccountEnabled eq false"
# Display the disabled users
$DisabledUsers
This will retrieve all users from Azure AD tenant and filter the results to include only those users whose AccountEnabled
property is set to false
, which indicates that the user’s account is disabled.
We can also use PowerShell to export all disabled users in Microsoft 365. Here is the PowerShell script to do that:
# Import the Azure AD module
Import-Module AzureAD
# Connect to Azure AD
Connect-AzureAD
# Get the Account Status of all users
$AccountsDisabled = Get-AzureADUser -All $True | Where-Object { $_.AccountEnabled -eq $false}
#Export Disableds users to CSV
$AccountsDisabled | Select-Object DisplayName, UserPrincipalName | Export-CSV "C:\Temp\DisabledUsers.csv" -NoTypeInformation
This script can be used to quickly pull up a list of all disabled accounts in your tenant and export them to a CSV file.
Get the Sign-in Disabled Status of a Particular user using PowerShell
How about checking if a given user account is enabled or disabled?
#User ID Parameter
$UserID = "LidiaH@Crescent.com"
# Connect to Azure AD
Connect-AzureAD
# Get the Account Status
$AccountEnabled = (Get-AzureADUser -ObjectId $UserID).AccountEnabled
If ($AccountEnabled) {
Write-Host "Account is enabled!" -f Green
} Else {
Write-Host "Account is disabled!" -foreground Red
}
Conclusion:
Finding disabled users in Office 365 doesn’t have to be difficult! With just a few simple steps – Opening up Azure AD Admin Center, using filters, or running PowerShell commands – you can quickly and easily identify which users have been disabled within your organization.