This commit is contained in:
jnisbet 2024-02-19 16:12:53 +00:00
commit a747bab4af
2 changed files with 41 additions and 0 deletions

1
PasswordEnvoke.bat Normal file
View File

@ -0,0 +1 @@
powershell C:\Users\joshua.nisbet\Documents\Passwordgen\PasswordGenerator.ps1

40
PasswordGenerator.ps1 Normal file
View File

@ -0,0 +1,40 @@
$RootDirectory = "F:\Documents\IDB\Internal IT\Asset Provisioning\User Accounts\PasswordGenerator"
function Get-RandomWord
{
if(-not $words)
{
$WordsFile = $RootDirectory + "\words.json"
$Script:words = Get-Content -Raw -Path $WordsFile | convertfrom-json
}
$words["$(get-random -Maximum ($words.count))"]
}
function Get-RandomCharacter
{
if(-not $character)
{
$character = "$%^&)(-_{}[];#.\|<:@~+"
}
$character["$(get-random -Maximum ($character.Length))"]
}
$UpperCaseWord = Get-RandomWord as string
$LowerCaseWord = Get-RandomWord
$Number = Get-Random -Minimum 10 -Maximum 99
$RandomCharacter = Get-RandomCharacter
$Password = $LowerCaseWord + $RandomCharacter + $UpperCaseWord.ToUpper() + $RandomCharacter + $Number
$Password | Set-Clipboard