?
Solved

Need Active Directory custom search to find account that do not expire

Posted on 2009-07-06
3
Medium Priority
?
814 Views
Last Modified: 2012-05-07
Hi,
I need to find which of my AD users are not expiring.
I found something that looks like it but doesn't work when cutting and pasting it in a custom search:

"(&(objectCategory=person)(objectClass=user)" _
    & "(|(accountExpires=9223372036854775807)(accountExpires=0)))"

I have also found this:
strFilter = "(&(objectCategory=person)(objectClass=user)" _
& "(userAccountControl:1.2.840.113556.1.4.803:=65536))"

But they don't work, can you tell me what is the EXACT semantic I can just cut and paste in the "Enter LDAP query"  field.
Tx!
0
Comment
Question by:SigSupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
Archonaus earned 1000 total points
ID: 24785273
Sorry I not sure I understand what you're after... do you want a list of accounts whose password is set never to expire?

If so, cut and paste this:

(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=65536))

I tried this on my AD and it worked fine.  Make sure you check your Query Root is set correctly too to include the containers you want the search to apply to.
0
 
LVL 57

Assisted Solution

by:Mike Kline
Mike Kline earned 1000 total points
ID: 24785479
Archonaus has the right query there
another really good tool for this is adfind by MVP Joe Richards
http://www.joeware.net/freetools/tools/adfind/index.htm
you can certainly use the longer LDAP filter in adfind but Joe also has some really nice shortcuts
so
adfind -sc users_noexpire samaccountname
That will dump users that have passwords set to never expire and output the samaccountname
 
some other useful and similar shortcuts

   -sc users_disabled      Dump disabled users.
   -sc users_noexpire      Dump non-expiring users.
   -sc users_accexpired    Dump accounts that are expired (NOT password expiration).
   -sc users_pwdnotreqd    Dump users set with password not required.
   -sc computers_disabled  Dump computers that are disabled.
   -sc computers_pwdnotreqd Dump computers set with password not required.
   -sc computers_active    Dump computers that are enabled and password last
Thanks
Mike
 
 
0
 

Author Closing Comment

by:SigSupport
ID: 31600166
With these answers I will get exactly what I need.
Thanks!
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question