You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
505 B
PowerShell

2 years ago
# AD Account Expiration Script
$expired = Search-ADAccount -AccountExpired | Select Name, SamAccountName, Manager, Enabled, AccountExpirationDate
$expiring = Search-ADAccount -AccountExpiring -TimeSpan "14" | Select Name, SamAccountName, Manager, Enabled, AccountExpirationDate
$disabled = Search-ADAccount -AccountDisabled | Select Name, SamAccountName, Manager, Enabled, AccountExpirationDate
&{$expired; $expiring; $disabled} | Export-Csv .\ad_account_expiration_report.csv -NoTypeInformation