Fix compatibiltiiy handling user account disables
This commit is contained in:
parent
779d2ad2dd
commit
5d74bd4e21
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user