Avatar of daskas27
daskas27
Flag for United States of America asked on

AD Users With Expiration

Hi,
      I am using ADFind to list my AD users. I would like to add the account expirations if possible. Here is the current script that gives me all the users with their names:

adfind -default -f "&(objectcategory=person)(objectclass=user)" samaccountname displayname -csv > c:\users.csv
Is this possible?

Thank you
Active DirectoryPowershell

Avatar of undefined
Last Comment
daskas27

8/22/2022 - Mon
SquigglyMonkey

Do you want to continue using adfind, or powershell?
SquigglyMonkey

Use to luv me some joeware!!
adfind -default -f "&(objectcategory=person)(objectclass=user)" samaccountname displayname accountexpires -csv > c:\users.csv

Open in new window


You prolly can't really read it though, cause it is in MS speak....
daskas27

ASKER
Me love joeware too! However the dates came back as: 9.22337E+18

Thank you
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
SquigglyMonkey

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
daskas27

ASKER
I ran the last script in the elevated powershell as directed. It returned the names but no expiration dates. The column was there but they were all blank.
SquigglyMonkey

Are the accounts set to "not expire"? Spot check and see if an account actually has an expiration date.
daskas27

ASKER
Ah ha! That is it. Hey, thanks for your help. Would you want to throw in a lookup for expiring passwords?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SquigglyMonkey

How about this,
get-aduser your-user-name -properties *

Open in new window


This will give you all the properties for your AD account, then find the one(s) you want and add it to the command I gave you above. :)
daskas27

ASKER
Thanks again