Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

search-adaccount

$
0
0

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?

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles