Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AD Users With Expiration

Posted on 2016-08-09
9
Medium Priority
?
78 Views
Last Modified: 2016-08-10
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
0
Comment
Question by:daskas27
[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
  • 5
  • 4
9 Comments
 
LVL 1

Expert Comment

by:SquigglyMonkey
ID: 41749681
Do you want to continue using adfind, or powershell?
0
 
LVL 1

Expert Comment

by:SquigglyMonkey
ID: 41749722
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....
0
 
LVL 1

Author Comment

by:daskas27
ID: 41750159
Me love joeware too! However the dates came back as: 9.22337E+18

Thank you
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 1

Accepted Solution

by:
SquigglyMonkey earned 2000 total points
ID: 41750281
That's what I said. I don't think you can use that particular Joeware tool for that, not natively anyway.
open an elevated powershell session and try this:
import-module activedirectory
Get-AdUser -Filter * -Properties * | Select SAMAccountname, DisplayName, AccountExpirationDate | Export-CSV -Path C:\path\to\folder\file.csv

Open in new window

Change the path to wherever you need the exported file.
0
 
LVL 1

Author Comment

by:daskas27
ID: 41750335
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.
0
 
LVL 1

Expert Comment

by:SquigglyMonkey
ID: 41750374
Are the accounts set to "not expire"? Spot check and see if an account actually has an expiration date.
0
 
LVL 1

Author Comment

by:daskas27
ID: 41750406
Ah ha! That is it. Hey, thanks for your help. Would you want to throw in a lookup for expiring passwords?
0
 
LVL 1

Expert Comment

by:SquigglyMonkey
ID: 41750440
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. :)
0
 
LVL 1

Author Closing Comment

by:daskas27
ID: 41750459
Thanks again
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

718 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