I don't get the opportunity to contribute all that often so I thought I
would throw this out there in case it helps anyone.

I got the method from this article:
https://www.scriptjunkie.us/2013/09/secure-random-password-generation/

I modify the resulting password by prepending/appending a couple of special
and numerical characters to ensure it meets complexity requirements in my
current environment.

Easy way to generate a secure password whenever the need arises. Critiques
are always welcome.

===================================================================

# Generate Random Password

$randombytes = new-object byte[] 15
(new-object
System.Security.Cryptography.RNGCryptoServiceProvider).GetBytes($randombytes)
$pass = [System.Convert]::ToBase64String($randombytes)
$password = "&#" + $pass + "82"

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

==================================================================

- Sean


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to