Solved

powershell | Active directory | password expiry

Posted on 2014-12-12
3
188 Views
Last Modified: 2014-12-12
Get-ADUser -filter * -properties passwordlastset | sort-object name | select-object Name, passwordlastset | Export-csv -path c:\scripts\user-password-info.csv

I would like to add 300 days to passwordlastset in-order to get the password expiry date.  I would like the password expiry date to be in the csv.
0
Comment
Question by:cmatchett
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 40496081
Haven't tested to verify, but I believe the following is correct.
Get-ADUser -filter * -properties passwordlastset | sort-object name | select-object Name, passwordlastset,@{n="expires";e={($_.passwordlastset).AddDays(300)}} | Export-csv -path c:\scripts\user-password-info.csv

Open in new window

0
 

Author Comment

by:cmatchett
ID: 40496120
works.  thank you very much !!
0
 

Author Closing Comment

by:cmatchett
ID: 40496133
excellent !
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Resolve DNS query failed errors for Exchange
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 to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

910 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now