Get inactive users in active directory

  • Thread starter Thread starter Alaa Elayes
  • Start date Start date
A

Alaa Elayes

Guest
Hello,I got a script to get all inactive users in our domain like the bellow:$DaysInactive = ((Get-Date).AddDays(-90)).Date$InactiveUsers = Get-ADUser -Filter {(LastLogonDate -lt $DaysInactive) -and (enabled -eq $true)} -Properties * | select-object samaccountname,givenname,surname,LastLogonDate,DistinguishedName,enabled$InactiveUsers | Export-Csv C:\InactiveUsers10.csv -NoTypeInformation the above script gets exchange enabled accounts and I need to exclude its

Continue reading...
 
Back
Top