Here is a useful little script to help you clean up your Active Directory. This PowerShell script outputs a .CSV file (so you can then edit and sort in Excel) which includes the User Name, Last Logon Date, Account Name, Distinguished Name, and Description.
Get-ADUser -Filter {Enabled -eq $false} -Properties Name, SamAccountName, DistinguishedName, Description, LastLogonDate | Select-Object Name, LastLogonDate, SamAccountName, DistinguishedName, Description | Export-Csv -NoTypeInformation -Path "C:\DisabledUsers.csv"
0 Comments