Dave Herrell - Blog - IT Toolbox - PowerShell Banner

PowerShell Basics: List Users with Expired Passwords

A basic PowerShell script that can come in handy is one that reviews a list of all users in your Active Directory domain with expired passwords.   You can use this to create reports, or even send as attachments to say, your Slack on Monday’s before your Helpdesk starts getting folks screaming they can login. 

Run the following PowerShell script as an admin:

				
					get-aduser -filter * -properties passwordlastset, passwordneverexpires |ft Name, passwordlastset, Passwordneverexpires
				
			

This will load the Active Directory module into PowerShell, and print a list of users with expired passwords. 

If you want to export this into a CSV file, you can run the script with an export pipe like this:

				
					get-aduser -filter * -properties passwordlastset, passwordneverexpires |ft Name, passwordlastset, Passwordneverexpires | Export-csv -path C:\Users\dave\Desktop\user-password-info.csv
				
			

Makes sure you update the export path on that script 🙂 

Hope you find this helpful!