Solved

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

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VM sizing and performance consideration for Exchange Server 2013 ? 10 65
Time sync on Domain 5 36
Active Directory Design - Best Practice 9 47
MFA in Azure for a hybrid org 2 34
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
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…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

685 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