Fix compatibiltiiy handling user account disables

This commit is contained in:
Corbin 2024-05-13 12:30:27 -04:00
parent 779d2ad2dd
commit 5d74bd4e21

View File

@ -19,7 +19,9 @@ $Users = Get-ADUser -SearchBase "$UsersOU" -Filter * -Properties * `
| select DisplayName,userPrincipalName,lastLogon,distinguishedName | % { $_.lastLogon = [DateTime]::FromFileTime($_.lastLogon); $_ }
# Disable the accounts
$Users | Disable-ADAccount
foreach ($User in $Users) {
Disable-ADAccount -Identity $User.distinguishedName
}
# Email a report
if (($Users.distinguishedName).Count -gt 0) {