Amazon Widget

Tuesday, May 03, 2011

PowerShell script to get Password Expiration

A little something I just wrote that will dump to a .CSV file the Password Expiration date for a list of users from an input text file.  It's one line.  I love PowerShell. :)  

NOTE:  This script was tested only on Windows Server 2008 SP2 in a Windows Server 2003 forest, and requires the Quest ActiveRoles Management Shell be installed.  I make no guarantees about other OSes. You assume all risk associated with running this script in your environment and I cannot be held liable for any damage that may occur from your use of this script.

get-content -path "[path to input text file]" | Get-QADUser -IncludeAllProperties | Select-Object dn, SamAccountName, passwordexpires | Export-Csv -Path [insert path to CSV file] -NoClobber

Enjoy!

No comments: