Solved

powershell | Active directory | password expiry

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

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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

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…
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
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.
Suggested Courses

630 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