Get-PasswordCombination

Description

Get-PasswordCombination creates all possible passwords based on the character set and parameters that you will use and provides the results in the output. If you will not pipe the results in another cmdlet, the generated password will appear in console.

Note: You need to install DictionaryFile module version 2.0 in order for this cmdlet to be available. For more information, see PowerShell Module DictionaryFile v2.0.

Syntax:

Get-PasswordCombination [-CharacterSet] <String> [-MinCharacters] <UInt32> [-MaxCharacters] <UInt32> [-IncludeCapital] [-CapitalOnly] [<CommonParameters>]

If you want to find more about the specific cmdlet while you are in PowerShell you can use the below to get the help file.

Code:

Get-Help Get-PasswordCombination

Output:

Now lets see few examples about Get-PasswordCombination .

[adinserter name=”In Article”]

Examples

Example 1

In this example we will create passwords for the characters set “a,b,c” with minimum number of characters one and maximum number of characters 2

PS C:\> Get-PasswordCombination -CharacterSet "a,b,c" -MinCharacters 1 -MaxCharacters 2 a b c aa ab ac ba bb bc ca cb cc

Example 2

For this example we are using the same characters set as example 1 but we will include also the capital letters.

PS C:\> Get-PasswordCombination -CharacterSet "a,b,c" -MinCharacters 1 -MaxCharacters 2 -IncludeCapital a b c A B C aa ab ac aA aB aC ba bb bc bA bB bC ca cb cc cA cB cC Aa Ab Ac AA AB AC Ba Bb Bc BA BB BC Ca Cb Cc CA CB CC

Example 3

Here we will see that we will have only the capital letters of our character set.

PS C:\> Get-PasswordCombination -CharacterSet "a,b,c" -MinCharacters 1 -MaxCharacters 2 -CapitalOnly A B C AA AB AC BA BB BC CA CB CC

Example 4

For this example instead of using the characters one by one. I am providing the whole alphabet. Note that I have removed some records from the output and replaced it with “…”

PS C:\> Get-PasswordCombination -CharacterSet "alphabet" -MinCharacters 1 -MaxCharacters 3 a b c d e f g h i j k l m n ... xu xv xw xx xy xz ya yb yc yd ye yf yg ... zzz

Example 5

You are allowed also to have a specific pattern in your generated passwords, by providing more that one characters between the comma.

PS C:\> Get-PasswordCombination "av,b,c" -MinCharacters 2 -MaxCharacters 2 avav avb avc bav bb bc cav cb cc

Example 6

Input can also be provided through the pipeline.

PS C:\> "a,b,c" | Get-PasswordCombination -MinCharacters 2 -MaxCharacters 2 aa ab ac ba bb bc ca cb cc

Example 7

You are able also to use the command in combination with other cmdlets either to perform some filtering or any other processing.

PS C:\> Get-PasswordCombination -CharacterSet "ad,b,c" -MinCharacters 3 -MaxCharacters 3 | Where-Object {$_ -like "*db*"} adadb adbad adbb adbc badb cadb

[adinserter name=”In Article”]

Required Parameters

-CharacterSet Description: Specifies the characters (letters, numbers, symbols) that need to be included. Required: True Position: 1 Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False

-MinCharacters Description: Specifies the minimum characters of the generated passwords. Required: True Position: 2 Default value: 0 Accept pipeline input: False Accept wildcard characters: False

-MaxCharacters Description: Specifies the maximum characters of the generated passwords. Required: True Position: 3 Default value: 0 Accept pipeline input: False Accept wildcard characters: False



[adinserter name=”In Article”]

Optional Parameters

-IncludeCapital Description: Specifies whether or not to include upper case letters along with the lower case letters. Required: false Position: named Default value: False Accept pipeline input: False Accept wildcard characters: False

-CapitalOnly Specifies whether or not all lower case letters to be converted to upper case letters. Required: False Position: named Default value: False Accept pipeline input: False Accept wildcard characters: False



Inputs

System.String.

Get-PasswordCombination can accept a string value to determine the CharacterSet parameter.

Outputs

System.String.

Get-PasswordCombination returns the generated password.

[adinserter name=”In Article”]

Related Links

[adinserter name=”Matched-Content”]