If a PowerShell script is correctly implemented with a cryptographically secure generator, it can be a good option. In practice, for those of us who do not have those skills, without reviewing the code there are no guarantees, and it is usually more reliable to use the built-in generator of a recognized password manager, because it eliminates doubts about the quality of the algorithm and entropy.![]()
Well, personally I would not be able to make the script he made for me a few years ago, it works great for me. Incase someone else wants to take look and/or try it, this is what he made for me back then.
$PasswordLength = 32
$PasswordString = ''
# Define character sets
$lowercase = 'abcdefghijkmnpqrstuvwxyz' # Excluded: l, o
$uppercase = 'ABCDEFGHJKLMNPQRSTUVWXYZ' # Excluded: I, O
$numbers = '23456789' # Excluded: 0, 1
$symbols = '!@#$%^&*()_+-=[]{}|;:,.<>?'
# Combine all allowed characters
$allChars = $lowercase + $uppercase + $numbers + $symbols
# Ensure at least one character from each set
$PasswordString += $lowercase[(Get-Random -Minimum 0 -Maximum $lowercase.Length)]
$PasswordString += $uppercase[(Get-Random -Minimum 0 -Maximum $uppercase.Length)]
$PasswordString += $numbers[(Get-Random -Minimum 0 -Maximum $numbers.Length)]
$PasswordString += $symbols[(Get-Random -Minimum 0 -Maximum $symbols.Length)]
# Fill the rest randomly
while ($PasswordString.Length -lt $PasswordLength) {
$PasswordString += $allChars[(Get-Random -Minimum 0 -Maximum $allChars.Length)]
}
# Shuffle the password to mix the required characters
$PasswordString = ($PasswordString.ToCharArray() | Sort-Object {Get-Random}) -join ''
Write-Host $PasswordString
$PasswordString = ''
# Define character sets
$lowercase = 'abcdefghijkmnpqrstuvwxyz' # Excluded: l, o
$uppercase = 'ABCDEFGHJKLMNPQRSTUVWXYZ' # Excluded: I, O
$numbers = '23456789' # Excluded: 0, 1
$symbols = '!@#$%^&*()_+-=[]{}|;:,.<>?'
# Combine all allowed characters
$allChars = $lowercase + $uppercase + $numbers + $symbols
# Ensure at least one character from each set
$PasswordString += $lowercase[(Get-Random -Minimum 0 -Maximum $lowercase.Length)]
$PasswordString += $uppercase[(Get-Random -Minimum 0 -Maximum $uppercase.Length)]
$PasswordString += $numbers[(Get-Random -Minimum 0 -Maximum $numbers.Length)]
$PasswordString += $symbols[(Get-Random -Minimum 0 -Maximum $symbols.Length)]
# Fill the rest randomly
while ($PasswordString.Length -lt $PasswordLength) {
$PasswordString += $allChars[(Get-Random -Minimum 0 -Maximum $allChars.Length)]
}
# Shuffle the password to mix the required characters
$PasswordString = ($PasswordString.ToCharArray() | Sort-Object {Get-Random}) -join ''
Write-Host $PasswordString



