Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

powershell | Active directory | password expiry

Posted on 2014-12-12
3
Medium Priority
?
199 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
[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
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
footech earned 2000 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

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

Question has a verified solution.

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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦
Suggested Courses

722 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