-
Notifications
You must be signed in to change notification settings - Fork 0
Last Password Change
zerksees edited this page Mar 2, 2024
·
2 revisions
In this wiki I'll be walking through how to:
- create a powershell script that will query your active directory for the last time a password was changed
- 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!
- create a file called
last-pass-chg.ps1
- enter the following code. this will prompt you for the username you want to query in the script.
- 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'
- restart your terminal session
- run
last-pass-chg
from any directory in the terminal.