Functions/Authentication/New-DictionaryPassword.ps1

Function New-DictionaryPassword
    {
    [CmdletBinding()]
    Param
        (
        # Specific Characters to Omit
        [Parameter(Mandatory=$false)]
        $Dictionary = (Import-Csv "${GLOBAL:PS_Helios.Common_Directory}\Assets\CombinedDictionary.csv")
        )

    Process
        {
        # Construct Security Tag
        $A1 = ([array](65..72)+(74..78)+(80..90) | foreach{[char]$_})[(Get-Random -Maximum 24)]
        $N1 = (Get-Random -Maximum 8)+1
        $N2 = (Get-Random -Maximum 8)+1
        $S1 = ([array]("!","@","#","$","%","&","+","?"))[(Get-Random -Maximum 8)]
        $Tag = ([array]($A1,$N1,$N2,$S1) | Sort {Get-Random}) -join ''

        # Get Base Adj and Noun From Dictionary
        $AdjIndex = Get-Random -Maximum ($Dictionary | where Type -like "Adjective").Count
        $Adj = ($Dictionary | where Type -like "Adjective")[$AdjIndex]
        $NounIndex = Get-Random -Maximum ($Dictionary | where FirstLetter -eq $Adj.FirstLetter | where Type -like "Noun").Count
        $Noun = ($Dictionary | where FirstLetter -eq $Adj.FirstLetter | where Type -like "Noun")[$NounIndex]

        # Combine Base Words and Securite Tag
        $PW = "$($Adj.word).$($Noun.word).$($Tag)"
        
        # Output Password
        $PW
        }
    }