Disabled Users with LastLogOnDate and OU Structure

Copy the Script below it will produce an output file with the results where you have ran the script, you can add a network path if preferred. Script will show Disabled accounts with Last login Date and location of the account.

Echo “Input computer name: ”

$Computer = Read-Host

$Credential = Get-Credential

Import-Module ActiveDirectory

Search-ADAccount -Accountdisabled | format-List Name, LastLogonDate, SamAccountName, DistinguishedName | Out-File “TestDisableUsers.csv”

 

Cheers

 

Warwick