1st
This commit is contained in:
commit
a747bab4af
|
|
@ -0,0 +1 @@
|
|||
powershell C:\Users\joshua.nisbet\Documents\Passwordgen\PasswordGenerator.ps1
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue