New-DictionaryFile
Description
New-DictionaryFile creates all possible passwords based on the character set and parameters that you will use and saves the results in a text file.
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:
New-DictionaryFile [-CharacterSet] <String> [-MinCharacters] <UInt32> [-MaxCharacters] <UInt32> [-IncludeCapital] [-CapitalOnly] [-Path] <String> [-WhatIf] [-Confirm] [<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 New-DictionaryFile
Output:
Now lets see few examples about New-DictionaryFile
.
[adinserter name=”In Article”]
Examples
Example 1
In this example we will create passwords for the characters set “a,b,c,1,$” with minimum number of characters of two and maximum number of characters five. Generated passwords will be saved in C:\Scripts_Output\MyFile.txt.
PS C:\>New-DictionaryFile -CharacterSet "a,b,c,1,$" -MinCharacters 2 -MaxCharacters 5 -Path C:\Scripts_Output\MyFile.txt
Example 2
For this example we are using the same characters set as example 1 but we will include also the capital letters. Generated passwords will be saved in C:\Scripts_Output\MyFile.txt.
PS C:\>New-DictionaryFile -CharacterSet "a,b,c,1,$" -MinCharacters 2 -MaxCharacters 5 -IncludeCapital -Path C:\Scripts_Output\MyFile.txt
Example 3
Here we will see that we will have only the capital letters of our character set. Generated passwords will be saved in C:\Scripts_Output\MyFile.txt.
PS C:\>New-DictionaryFile -CharacterSet "a,b,c,1,$" -MinCharacters 2 -MaxCharacters 5 -CapitalOnly -Path C:\Scripts_Output\MyFile.txt
Example 4
For this example instead of using the characters one by one. I am providing the whole alphabet. Generated passwords will be saved in C:\Scripts_Output\MyFile.txt.
PS C:\>New-DictionaryFile -CharacterSet "alphabet" -MinCharacters 1 -MaxCharacters 3 -Path C:\Scripts_Output\MyFile.txt
Example 5
You are allowed also to have a specific pattern in your generated passwords, by providing more that one characters between the comma. Generated passwords will be saved in C:\Scripts_Output\MyFile.txt.
PS C:\>New-DictionaryFile "av,b,c" -MinCharacters 2 -MaxCharacters 2 -Path C:\Scripts_Output\MyFile.txt
Example 6
Input can also be provided through the pipeline. Generated passwords will be saved in C:\Scripts_Output\MyFile.txt.
PS C:\>"a,b,c" | New-DictionaryFile -MinCharacters 2 -MaxCharacters 2 -Path C:\Scripts_Output\MyFile.txt
[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
-Path
- Description: Specifies the path and file that generated passwords will be saved.
- Required: True
- Position: 4
- Default value: None
- 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
-WhatIf
- Required: False
- Position: named
- Default value: None
- Accept pipeline input: False
- Accept wildcard characters: False
-Confirm
- Required: False
- Position: named
- Default value: None
- Accept pipeline input: False
- Accept wildcard characters: False
Inputs
System.String.
New-DictionaryFile can accept a string value to determine the CharacterSet parameter.
Outputs
None.
New-DictionaryFile will save all the generated passwords to the specified path.
[adinserter name=”In Article”]
Related Links
- PowerShell Module DictionaryFile v 2.0
- Get-PasswordCombination
- Get-PasswordNumber
- Get-DictionaryFile
- PowerShell Gallery | DictionaryFile 2.0
- GitHub – SConstantinou/DictionaryFile
[adinserter name=”Matched-Content”]


Leave a Reply