Solved

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

Posted on 2009-07-06
3
813 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 250 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 250 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

691 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