Reply To: Alert if user is disabled in AD

Home Forums Scripting PowerShell Alert if user is disabled in AD Reply To: Alert if user is disabled in AD

Avatar
wullieb1
Moderator
#615627

Something like this should work, i don’t have anything that i can test with at the moment

foreach ($g in $groups) {

$member += (Get-ADGroupMember -Identity $g).sAMAccountName

}

foreach($m in $member) {

if ( -Not (Get-ADUser -Identity $m).Enabled) {

$diff =+ $m

}

}