I need to find all of the disabled accounts in a Group. I have this code:
$UserList = (get-adgroupmember -Identity zDisabledTest).name
foreach ($user in $UserList){Search-ADAccount -AccountDisabled -SearchBase $user}
$user
But it does not work. In the group zDisabledTest I have 2 users, myself (active) and a dummy account (disabled). I have played around with the -SearchBase field as well. I've tried with it, without it and nothing seems to work. What am I missing?