Generate Random Passwords

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

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

Comments

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 PowerShell.com. All rights reserved.