PowerShell Lab
Build, find and save PowerShell
Reviewed templates and commands with requirements, permissions and risk spelled out. Nothing here runs anything — you copy, review and run it yourself.
Search pages, tools, PowerShell commands and ports
Set a temporary password, unlock the account and force a change at next sign-in.
1#Requires -Modules ActiveDirectory2$user = 'jdoe'3$temp = Read-Host -Prompt 'Temporary password' -AsSecureString4 5Set-ADAccountPassword -Identity $user -Reset -NewPassword $temp6Set-ADUser -Identity $user -ChangePasswordAtLogon $true7Unlock-ADAccount -Identity $userRead-Host -AsSecureString keeps the password out of your history and the script file. Tell the user the password through a separate channel.