Link to home
Start Free TrialLog in
Avatar of Rhala
Rhala

asked on

How to Query Active Directory for specific attribute

Dear all,

How I can know which users don’t have picture imported in active directory? Is there a command or shell or anything I can use??

Thanks
Avatar of ThinkPaper
ThinkPaper
Flag of United States of America image

You can run a powershell query to check the value of thumbnailPhoto attribute for each user account.

Import-Module ActiveDirectory
 Get-ADUser -Filter * -SearchBase "OU=Staff,DC=nwtraders,DC=msft" -properties thumbnailPhoto | ? {!$_.thumbnailPhoto} | select Name

http://davehope.co.uk/Blog/find-accounts-without-a-thumbnail-photo/
http://social.technet.microsoft.com/Forums/windowsserver/en-US/f436cd38-8539-4883-903a-6f28c741e2c2/export-ad-users-thumbnailphoto-attributes-details-to-excel-spreadsheet?forum=winservergen
Avatar of Premkumar Yogeswaran
Hi,

Please find the option to query via DS Command:

To query users who doesn't have pictures in their User account.
dsquery * -filter "&(ObjectCategory=User)(!thumbnailPhoto=*)" - Limit 0 -attr DisplayName

Open in new window


To query users who have pictures in their User account.
dsquery * -filter "&(ObjectCategory=User)(thumbnailPhoto=*)" - Limit 0 -attr DisplayName

Open in new window



Regards,
Prem
Avatar of Rhala
Rhala

ASKER

Dear ThinkPaper, it's seems the command provide the value which users have photo, what i need is a list of users which thy don't have photo.


Dear Premkumar Yogeswaran, i run the command and i get the below error:

User generated image
ASKER CERTIFIED SOLUTION
Avatar of ThinkPaper
ThinkPaper
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial