troubleshooting Question

Interactive Powershell script to reset password age in AD

Avatar of Lennart Giaccotto
Lennart Giaccotto asked on
Active DirectoryShell ScriptingPowershell
4 Comments2 Solutions764 ViewsLast Modified:
I am looking for a script to reset the password age for a specific useraccount in our AD. I found the script that makes this happen:

$User = Get-ADUser username -properties pwdlastset 
$User.pwdlastset = 0 
Set-ADUser -Instance $User 
$user.pwdlastset = -1 
Set-ADUser -instance $User

Wat i need is a way for our helpdesk to use this script without having to change the username everytime they use the script. This can be done by adding a prompt to enter the username and a check if this is correct but i have no experience with powershell how to give a prompt to fill in a variable.

Can someone show me how this is done? I prefer to use it in combination with the function Show-Menu so i can add more functionality to the script in a later stage .
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros