I am very noob with the powershell and everything similar to be honest.
I am trying to achieve a simple batch file to execute and make unlocking user accounts simplified.
Currently I have managed to create the below based on googling, this would simply unlock a user account called "USERNAME".
powershell -Command "& { import-module activedirectory; unlock-adaccount USERNAME }"
What I am trying to achieve is setting that "USERNAME" part as a variable and creating a prompt when executing the batch file to ask for a username in order to be able to unlock any account typed.
I have tried searching related posts but can't seem to find a way to put it together myself. I would appreciate any help that can be offered!
Thank you.
Use the
Read-Host
command e.g.: