Solved

powershell | Active directory | password expiry

Posted on 2014-12-12
3
187 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

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
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 …

746 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

10 Experts available now in Live!

Get 1:1 Help Now