Get a list of Disabled Users in Active Directory using PowerShell

Sdílet
Vložit
  • čas přidán 16. 07. 2024
  • 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
  • Věda a technologie

Komentáře •