Friday, 23 July 2010

How to find users logon name by their mail address for bulk users?

For Single user
dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(mail=e-mailaddress))" -attr name

For bulk users
for /f %%x in (%1) do dsquery * domainroot -filter "(&(objectcategory=person)(objectclass=user)(mail=%%x))" -attr name

No comments:

Post a Comment