ok,
Here is a powershell script I wrote awhile back. thought Id post it. its a really random password generator:
$pwdlength = [int]
$pwdlength = Read-Host "please provide desired password length"
$bytes = [byte[]][byte]1
$pwd = [string]""
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
for($i=1;$i -le $pwdlength;$i++)
{
$rng.getbytes($bytes)
$rnd = $bytes[0] -as [int]
$int = ($rnd % 74) + 48
$chr = $int -as [char]
$pwd = $pwd + $chr
}
write $pwd
$pwdlength = Read-Host "please provide desired password length"
$bytes = [byte[]][byte]1
$pwd = [string]""
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
for($i=1;$i -le $pwdlength;$i++)
{
$rng.getbytes($bytes)
$rnd = $bytes[0] -as [int]
$int = ($rnd % 74) + 48
$chr = $int -as [char]
$pwd = $pwd + $chr
}
write $pwd
enjoy.
maybe later, I will modify it to control special characters. or if someone wants to figure it out, I will repost the code.
-Nex6
1 comments:
Neat! I like this script.
Post a Comment