Solved

powershell | Active directory | password expiry

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
A brief introduction to what I consider to be the best editor for PowerShell.
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 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…

776 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