Hi,
I would like to use a custom password generation script written using powershell.
The custom script is essential just a copy of the default, but I swapped the "New-Password" function with my own and then deleted some of the other checks the default script does.
The password generation piece is another script I found online that I tweaked slightly to meet my requirements.
The new script also needs to reference a CSV file.
I have two questions regarding this:
- Can you reference a CSV file stored locally on the C: drive of the ARS server from within a script module? Or is it possible to store the file inside ARS itself? If the file can be stored inside ARS, how is it referenced?
- How can I test this new password generation script in ARS? It appears that we have already blocked the builtin "Built-in Policy - Password Generation" and created our own policy that appears to just be a copy of the default. I tried changing the script that the custom policy runs, but it still generates the same passwords.
function Create-Password { $rand = New-Object System.Random # read-in very large file creating smaller list of random words $words = Get-Content "C:\Scripts\Generation\clean_words.csv" | Sort-Object {Get-Random} -unique | select -first 100 # query the smaller list of words for single entry (2 times) $word1 = $words | Sort-Object {Get-Random} -unique | select -first 1 $word2 = $words | Sort-Object {Get-Random} -unique | select -first 1 $word3 = $words | Sort-Object {Get-Random} -unique | select -first 1 # create random digits $number1 = Get-Random -Minimum 10 -Maximum 99 # get random special character $special = Get-Random -InputObject "!","@","#","$","%","&","*" # Recreate word 2 $word2 = $word2.Substring(0,1).toupper() + $special + $word2.Substring(1,$word2.Length-1) # concatenante and return new random password return (Get-Culture).TextInfo.ToTitleCase($word1) + $word2 + (Get-Culture).TextInfo.ToTitleCase($word3) + $number1 }
Thank you,
Cheers