Generate Random Passwords

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell


In a previous tip, we showed you how to create random passwords. Thanks to your feedback, here is an even shorter version:

-join ([Char[]]'abcdefgABCDEFG0123456&%$' | Get-Random -count 20)


Twitter This Tip! ReTweet this Tip!

Posted Jun 15 2011, 08:00 AM by ps1


Robert wrote re: Generate Random Passwords
on 06-15-2011 8:14 PM

An enhancement to this to utilize printable characters, use: [CHAR[]]@(33..126) | Get-Random  -Count 20)

Another enhancement to further randomize by randomize the length, use: [CHAR[]]@(33..126) | Get-Random  -Count $(Get-Random -Minimum 7 -Maximum 15))

Copyright 2012 All rights reserved.