From 2c8f9d87c2c6f7985b2748714a6f4efc1a75dcdc Mon Sep 17 00:00:00 2001 From: Danny de Kooker <5+d.dekooker@noreply.localhost> Date: Mon, 15 Jun 2026 07:46:45 +0000 Subject: [PATCH] Change the way AD read Enabled accounts --- Active Directory/Account-expiration-send_mail.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Active Directory/Account-expiration-send_mail.ps1 b/Active Directory/Account-expiration-send_mail.ps1 index 5feffc9..4b5dcbd 100644 --- a/Active Directory/Account-expiration-send_mail.ps1 +++ b/Active Directory/Account-expiration-send_mail.ps1 @@ -64,7 +64,7 @@ #region script #Collect all users and the attributes we need foreach ($SearchBase in $STR_OUSearchBase) { - $QRY_ADUsers = Get-ADUser -SearchBase $SearchBase -Filter {Enabled -eq $true -and PasswordNeverExpires -eq $false } -Properties 'msDS-UserPasswordExpiryTimeComputed', 'mail' + $QRY_ADUsers = Get-ADUser -SearchBase $SearchBase -Filter {(Enabled -eq $true) -and (PasswordNeverExpires -eq $false)} -Properties 'msDS-UserPasswordExpiryTimeComputed', 'mail' #Start foreach statement of above query foreach ($User in $QRY_ADUsers) {