Get a list of Disabled Users in Active Directory using PowerShell

Published: 03 October 2023
on channel: vCloudBitsBytes
1,594
13

Learn how to retrieve a list of disabled users in Active Directory using PowerShell. Managing user accounts in Active Directory involves various tasks, including enabling, disabling, and monitoring user activity. Retrieving a list of disabled users is crucial for security, auditing, or cleaning up inactive accounts. Follow this step-by-step guide to easily obtain the list using PowerShell.

Chapters
*********
00:00 - Intro
00:12 - Prerequisites
00:19 - Using Get-ADUser
01:47 - Using Search-ADAccount
02:11 - Outro

Use the Get-ADUser cmdlet to retrieve a list of disabled users by running the following command
***********************************************************************************************
Get-ADUser -Filter {Enabled -eq $false} -Properties * | Select-Object Name, GivenName, Surname, SamAccountName, UserPrincipalName, DistinguishedName, LastLogonDate

To save the list of disabled users for analysis or reporting, export it to a CSV file using the Export-Csv cmdlet
***********************************************************************************************
Get-ADUser -Filter {Enabled -eq $false} -Properties * | Select-Object Name, GivenName, Surname, SamAccountName, UserPrincipalName, DistinguishedName, LastLogonDate | Export-Csv -Path "C:\DisabledUsers.csv" -NoTypeInformation

You can also use the Search-ADAccount cmdlet to list disabled users. This can be done by using the -AccountDisabled parameter to search for disabled accounts, and the -UserOnly parameter to search only for users.
**********************************************************************************************
Search-ADAccount –AccountDisabled –UsersOnly | Select-Object SamAccountName, DistinguishedName


Watch video Get a list of Disabled Users in Active Directory using PowerShell online without registration, duration hours minute second in high quality. This video was added by user vCloudBitsBytes 03 October 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,594 once and liked it 13 people.