Last Password Change - zerksees/TheShed GitHub Wiki

Welcome to the TheShed wiki!

In this wiki I'll be walking through how to:

  1. create a powershell script that will query your active directory for the last time a password was changed
  2. I'll then show how to run this from WSL (optional if you use WSL) by creating an alias in your ~/.bashrc or ~/.bash_profile file which will call and run the powershell script right from the WSL terminal. this would eliminate having to fire up powershell, navigate to directory where the script is and (of course) running it.

cool... let's get into it!

  1. create a file called last-pass-chg.ps1
  2. enter the following code. this will prompt you for the username you want to query in the script.
  1. now open your .bashrc or .bash_profile file and create an alias to the powershell script by adding this to bottom of the .bashrc or .bash_profile file:
alias last-pass-chg='path\to\powershellscript\last-pass-chg.ps1'
  1. restart your terminal session
  2. run last-pass-chg from any directory in the terminal.