NewRandomPassword

2.0.0

Creates 1 or more randomly-generated strings of either static or variable length.

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name NewRandomPassword

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name NewRandomPassword

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

Copyright (c) 2019-2026 Yevrag35, LLC. All rights reserved.

Package Details

Author(s)

  • Mike Garvey

Tags

new random password generate generator multiple static variable dynamic first character iteration string output host passwords option specify min minimum max maximum count length

Cmdlets

New-RandomPassword

PSEditions

Core Desktop

Dependencies

This module has no dependencies.

Release Notes

2.0.0 runs on Windows PowerShell 5.1 and on PowerShell 7.6 or later. In PowerShell 7.5 or earlier, the import fails with an error that says so.

2.0.0 is released under the MIT License, in place of 1.2.0's GNU General Public License v3.0.

Every parameter, alias, position, and parameter set of 1.2.0 stays, and so does every default but the character groups. What changes from 1.2.0:

- Passwords are built from every letter and digit by default, and the same six symbols, 68 characters in all. 1.2.0 left out l, o, D, I, O, 0, and 1. To leave out characters that are easy to mistake for others, use -CharacterSet NoLookAlikes, Symbols.
- -InputStrings takes ABCDEFGHJKLMNPQRSTUVWXYZ, the uppercase letters except I and O, in place of 1.2.0's ABCEFGHJKLMNPQRSTUVWXYZ, which left out D by mistake, so a script that passes 1.2.0's string fails when PowerShell binds it. It also takes every lowercase letter, abcdefghijklmnopqrstuvwxyz, and every uppercase letter, ABCDEFGHIJKLMNOPQRSTUVWXYZ.
- -CharacterSet is new. It builds passwords from groups that you name, in place of the default groups: Lowercase, Uppercase, Digits, and Symbols, in any combination, as in -CharacterSet Lowercase, Digits. NoLookAlikes stands for the lowercase letters, the uppercase letters, and the digits without l, o, I, O, 0, and 1, and it combines with Symbols. -CharacterSet can't be used with -InputStrings, so Get-Command shows a twin of each of 1.2.0's two parameter sets, in which -CharacterSet takes the place of -InputStrings.
- -FirstCharacter always comes first. 1.2.0 put it last in about half the passwords.
- With -MinimumLength and -MaximumLength, each password gets a random length of its own. 1.2.0 gave every password of a call the same length.
- A password with fewer characters than there are groups holds characters from a random choice of the groups. 1.2.0 always took the first groups, so a password of 2 or 3 characters never held a symbol.
- A repeated character doesn't count twice. A character that a group lists twice is as likely as the group's other characters, and the characters that fill a password after one from each group are drawn from the distinct characters of all the groups. 1.2.0 drew a repeated character twice as often.
- -ExtraCharacters takes a string, a char, a char[], or a collection of them, such as the lines that Get-Content outputs, with one group per element. 1.2.0 refused a single line, a char, or a collection other than an array, and dropped every element that wasn't a string. Get-Command shows the type of -ExtraCharacters as String[] instead of Object.
- -FirstCharacter 5 starts each password with the digit 5. 1.2.0 read a bare number as a character code, so 5 was a control character, and 65, which was A, is now an error.
- An argument that can't make a password fails when PowerShell binds it, with an error that names the parameter: an empty group, a control character, a character that takes a surrogate pair, such as an emoji, or a value of another type for -ExtraCharacters.
- -OnlyUseExtraCharacters without -ExtraCharacters is an error. 1.2.0 ignored the switch.
- A minimum length greater than the maximum, and arguments that leave no characters to draw from, end the command with an error of their own. 1.2.0 threw raw exceptions, such as DivideByZeroException.
- -PasswordLength and -MaximumLength take at most 1,048,576 characters, and -MinimumLength at most 1,048,575. 1.2.0 accepted lengths that no string can hold.

FileList

Version History

Version Downloads Last updated
2.0.0 (current version) 12 10/29/2026
1.2.0 2,585 8/25/2019
1.1.0 42 7/26/2019
1.0.0 160 9/10/2018