Solved

need report of users that haven't changed password in 60 days  - Powershell to CSV

Posted on 2015-01-29
3
351 Views
Last Modified: 2015-02-02
need to export all users whos password hasnt been changed in the last 60 days

OU level
0
Comment
Question by:Jorge Ocampo
[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 12

Accepted Solution

by:
SreRaj earned 500 total points
ID: 40579138
Hi,

Please try following code from AD Module for PowerShell.

Get-ADUser -Filter * -Properties distinguishedname,cn,passwordlastset | where{$_.passwordlastset -ne $null} | where{$_.passwordlastset -le ((get-date).adddays(-60))} | select name,samaccountname,@{n='ParentContainer';e={$_.distinguishedname -replace '^.+?,(CN|OU.+)','$1'}} | export-csv userlist.csv -notypeinformation
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40579817
where do i specify the OU location what does the -replace do?
0
 
LVL 12

Expert Comment

by:SreRaj
ID: 40583289
You don't need to specify a OU as it runs on the complete domain and creates a list of all users whose last password set is older than 60 days. There will be a column with heading Parent Container which will give the OU name in which user account exists.

Output  of Get-AdUser does not contain Name of the OU for a user account. So this command takes the value in  distinguishedname attribute and trims it to take the OU name from it. -replace is used for this trimming.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

696 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