Generate random passwords using PowerShell.
Found this method from https://www.scriptjunkie.us/2013/09/secure-random-password-generation/ and modified by Sean Martin (myITforum.com PowerShell usergroup).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# Generate Random Password $randombytes = new-object byte[] 15 (new-object System.Security.Cryptography.RNGCryptoServiceProvider).GetBytes($randombytes) $pass = [System.Convert]::ToBase64String($randombytes) $password = "##" + $pass + "!!" Write-Host "" Write-Host "Your password is: " -ForeGroundColor Cyan -NoNewLine Write-Host "$Password" -ForeGroundColor Yellow Write-Host "" Write-Host "" Write-Host "Press enter to exit script..." -ForeGroundColor Cyan $Pause = Read-Host Exit |