PowerShell Module DictionaryFile
In this post I will provide you with some information about PowerShell Module DictionaryFile, which I wrote and published in PowerShell Gallery. This is my first module that I publish and I hope that you will like it.
Note: Module has been updated to version 2.0. Please check here to find the current version.
Module description
DictionaryFile will provide you with the ability to calculate the possible number of passwords based on your input and parameters. This module will allow you also to create those passwords and it will save them in a dictionary file that you are able to use at a later stage. The module currently will provide you with only two cmdlets. After you install the module and import it will make available the below cmdlets.
Get-PasswordNumber
Get-DictionaryFile
In this post I will not go through and explain the code behind the module but I will provide you with the features and how you are able to use the module. You can install the module by using the below:
Code:
Install-Module DictionaryFile
To import the module use the below:
Code:
Import-Module DictionaryFile
The module is Auto-import enabled so there is not need to import it every time you need to use any of the cmdlets.
[adinserter name=”In Article”]
Get-PasswordNumber
Get-PasswordNumber will calculate the number of possible password that you are able to generate based on your input and parameters. You can use this command to know beforehand what is the expected output when you want to create a dictionary file. It will provide you an answer before try to generate the file in order to whether to proceed to create such file or not. The cmdlet has a help file also so you can find more information about it.
Syntax:
Get-PasswordNnumber [-Characters <String[]> or "alphabet"] [-Numbers <String[]>] [-Symbols <String[]>] [-MinCharacters <uint32>] [-MaxCharacters <uint32>] [-IncludeCapital] [-CapitalOnly] [<CommonParameters>]
If you want to find more about the specific cmdlet while you in PowerShell you can use the below to get the help file.
Code:
Get-Help Get-PasswordNumber
Output:
You are also able to see the full version of help for the cmdlet by using the below:
Code:
Get-Help Get-PasswordNumber -Full
Now lets see few examples about Get-PasswordNumber
[adinserter name=”In Article”]
Example 1
In this example we will see the number of passwords that we are able to generate when we will have “a,b,c” for characters, “1,2,3” for numbers and “$,*,&” for symbols. We define also that we need the passwords to be minimum 2 characters and maximum 5.
Code:
Get-PasswordNumber -Characters "a,b,c" -Numbers "1,2,3" -Symbols "$,*,&" -MinCharacters 2 -MaxCharacters 5
Output:
Example 2
By using -IncludeCapital
parameter, we tell the cmdlet use also the upper case letters for the specified ones. The actual letters that will be used will be “a,b,c,A,B,C”.
Code:
Get-PasswordNumber -Characters "a,b,c" -Numbers "1,2,3" -Symbols "$,*,&" -MinCharacters 2 -MaxCharacters 5 -IncludeCapital
Output:
Example 3
-CapitalOnly
parameter will convert or lower case letters to upper case letters and it will calculate based on that.
Code:
Get-PasswordNumber -Characters "a,b,c" -Numbers "1" -Symbols "$" -MinCharacters 2 -MaxCharacters 5 -CapitalOnly
Output:
Example 4
Instead of specifying the exact letters that you would like to use, you are able also to use “alphabet” as input for -Characters
parameter. This will include all letters in English alphabet.
Code:
Get-PasswordNumber -Characters alphabet -Numbers "1,2,3" -Symbols "$,*,&" -MinCharacters 2 -MaxCharacters 5
Output:
[adinserter name=”In Article”]
Get-DictionaryFile
The second cmdlet that DictionaryFile module will provide you is Get-DictionaryFile
. This cmdlet will actually create the dictionary file with all possible passwords that you are able to generate using the specified letters, numbers and symbols. Get-DictionaryFile
will first calculate the number of possible passwords and it will wait for your confirmation whether to proceed or not to create the file with those password.
Syntax:
Get-DictionaryFile [-Characters <String[]> or "alphabet"] [-Numbers <String[]>] [-Symbols <String[]>] [-MinCharacters <uint32>] [-MaxCharacters <uint32>] [-IncludeCapital] [-CapitalOnly] [-Path <String[]] [<CommonParameters>]
If you want to find more about the specific cmdlet while you in PowerShell you can use the below to get the help file.
Code:
Get-Help Get-DictionaryFile
Output:
You are also able to see the full version of help for the cmdlet by using the below:
Code:
Get-Help Get-DictionaryFile -Full
Now lets see some examples for Get-DictionaryFile
cmdlet.
[adinserter name=”In Article”]
Example 1
In example 1 we are using “a,b,c,1,$” as our character set and we can see in the output below that the number of possible passwords is 3900. After our confirmation, it will check for the file and it will perform the appropriate changes in order to have a fresh dictionary file to start working with.
Code:
Get-DictionaryFile -Characters "a,b,c" -Numbers "1" -Symbols "$" -MinCharacters 2 -MaxCharacters 5
Output:
Test:
[adinserter name=”In Article”]
Example 2
Here we can see that we are also able to provide our own path where we need to save out dictionary file.
Code:
Get-DictionaryFile -Characters "a,b,c" -Numbers "1" -Symbols "$" -MinCharacters 2 -MaxCharacters 5 -Path C:\Scripts_Output\MyFile.txt
Output:
Test:
[adinserter name=”In Article”]
Example 3
In this example, we are using -IncludeCapital
parameter, which adds also the upper case letters of the specified ones. As you can see the number of possible passwords now is bigger as we have more characters now. The actual characters that it is using now are “a,b,c,1,$,A,B,C”.
Code:
Get-DictionaryFile -Characters "a,b,c" -Numbers "1" -Symbols "$" -MinCharacters 2 -MaxCharacters 5 -IncludeCapital
Output:
Test:
[adinserter name=”In Article”]
Example 4
Here by using -CapitalOnly
parameter we force our cmdlet to convert all lower case letters to upper case letters.
Code:
Get-DictionaryFile -Characters "a,b,c" -Numbers "1" -Symbols "$" -MinCharacters 2 -MaxCharacters 5 -CapitalOnly
Output:
Test:
[adinserter name=”In Article”]
Example 5
Code:
Get-DictionaryFile -Characters alphabet -Numbers "1" -Symbols "$" -MinCharacters 2 -MaxCharacters 5
Output:
Test:
[adinserter name=”In Article”]
Tests and Timings
As the number of possible passwords increases exponentially, the time to create the passwords is also increased exponentially. As you saw in my examples, I have provided also the timings for the command to run and create the file.
The specifications of the PC that I run the tests are:
- CPU: Intel Core i7-3770K@4.60GHz
- RAM: 16 GB
- OS: Windows 10 1803
- PowerShell Version: 5.1
Hope you like DictionaryFile module.
You feedback is appreciated.
If you have any questions or anything else please let me know in the comments below.
[adinserter name=”In Article”]
Related Links:
- PowerShell Scripts
- PowerShell Tutorials
- Install-Module – Microsoft Docs
- PowerShell Gallery DictionaryFile
- PowerShell Arithmetic Operators
- Import-Module – Microsoft Docs
- PowerShell Comparison Operators
- Get-Help – Microsoft Docs
- Add-Content – Microsoft Docs
- ForEach-Object – Microsoft Docs
- New-Alias – Microsoft Docs
- New-Item – Microsoft Docs
- Out-Null – Microsoft Docs
- about_For | Microsoft Docs
- about_If | Microsoft Docs
- about_Switch | Microsoft Docs
- about_Throw | Microsoft Docs
- Read-Host – Microsoft Docs
- Remove-Item – Microsoft Docs
- Select-Object – Microsoft Docs
- Split-Path – Microsoft Docs
- Test-Path – Microsoft Docs
- Write-Output – Microsoft Docs
- Write-Warning – Microsoft Docs
- Publish-Module – Microsoft Docs
- New-ModuleManifest – Microsoft Docs
- Get-Help – Microsoft Docs
[adinserter name=”Matched-Content”]


Leave a Reply