Prompt for user name AD status

Hello ,

I would like to apologize in advance if this topic has been covered, I did try to look for the solution.

I am trying to create a script for ISE to prompt for user account id or related name search for account status, such as locked out or bad passwords.

I have the basic script where I can input the name, but I am not sure how to plug in the -Prompt . The second line was going to be an option to unlock if the user was locked

$get-aduser -identity $Name -properties * | select accountexpirationdate, accountexpires, accountlockouttime, badlogoncount, padpwdcount, lastbadpasswordattempt, lastlogondate, lockedout, passwordexpired, passwordlastset, pwdlastset | format-list

Unlock-AdAccount testuser

I Believe something like this might work, but I haven’t tested it on a locked account.

$UserName = Read-Host “Enter part of the UserName you seek”
Get-ADUser -Filter “SamAccountName -like ‘$UserName’”
$UserName = Read-Host “User name to unlock”
Unlock-ADAccount -Identity $UserName