function GetRandomPassword { $ strSrc = ' 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$^&(){}[],. ' $ max = $ strSrc.Length $ strPass = '' for ($ i = 0 ; $ i -lt 20 ; $ i += 1 ) { $ index = Get-Random - Minimum 0 - Maximum $ max $ c = $ strSrc [$ index ] $ strPass += $ c } return $ strPass } create the above function in your powershell profile and you can generate random password at anytime. Happy Coding!!