I've recently discovered the "adminSDHolder" feature of Active Directory. I need a quick way to identify all users who will be affected by it, namely a script to dump the user accounts.

link|improve this question
feedback

1 Answer

up vote 12 down vote accepted

You can use this powershell script to return the users that have an adminCount greater than 0, which means that they are affected by the adminSDHolder feature. You'll need the AD Module for PowerShell installed, which comes with RSAT.

import-module activedirectory

get-aduser -Properties adminCount -Filter * -ResultSetSize $null| foreach-object{
   if ($_.adminCount -gt 0){
   echo $_
   }    
}

Edit:

As jbsmith points out, this should also work too, and is a bit cleaner:

import-module activedirectory

get-aduser -Filter {admincount -gt 0} -Properties adminCount -ResultSetSize $null| foreach-object{      
   echo $_          
}
link|improve this answer
4  
Here's a cleaner method of doing the same thing: get-aduser -filter {admincount -gt 0} -Properties admincount -ResultSetSize $null – jbsmith Aug 24 '11 at 20:18
also you could create a dsquery filter to do the same thing – tony roth Aug 25 '11 at 0:00
1  
@tony - You could, but the OP asked specifically for a PowerShell script. – MDMarra Aug 25 '11 at 2:53
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.