Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password Generator button
#1
Can you add a Password Generator button in the credentials view?
Reply
#2
(25-05-2020, 04:51 PM)martinrjl Wrote: Can you add a Password Generator button in the credentials view?


while im wating i made a powershel for it that i added as a external app.

Created: 20200529
Auth: Martin R
Based on: Steve Königs scipt https://activedirectoryfaq.com/2017/08/c...passwords/

V1.0
#

$fail=0
[int]$length = Read-Host "Password Length? (minimum 8 characters)"
if (($length -isnot [int])) {
                            Throw 'You did not enter a number'
                            $fail=1 
                            }
if ($length -In 1..8)  {
                        Throw 'To short Password.'
                        $fail=1
                        }
if ($fail -eq 1)    {
                    Write-Host "Input error please try again!"
                    Start-Sleep 5
                    exit
                    }


function Get-RandomCharacters($length, $characters) {
    $random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length }
    $private:ofs=""
    return [String]$characters[$random]
}

function Scramble-String([string]$inputString){   
    $characterArray = $inputString.ToCharArray() 
    $scrambledStringArray = $characterArray | Get-Random -Count $characterArray.Length   
    $outputString = -join $scrambledStringArray
    return $outputString
}

$password = Get-RandomCharacters -length $length -characters 'abcdefghiklmnoprstuvwxyzABCDEFGHKLMNOPRSTUVWXYZ1234567890!"§$%&/()=?}][{@#*+'
# if you wish to specify amount of a type of character use this part. i dont like it. makes all passwords follow the same pattern.
#$password = Get-RandomCharacters -length 5 -characters 'abcdefghiklmnoprstuvwxyz'
#$password += Get-RandomCharacters -length 1 -characters 'ABCDEFGHKLMNOPRSTUVWXYZ'
#$password += Get-RandomCharacters -length 1 -characters '1234567890'
#$password += Get-RandomCharacters -length 1 -characters '!"§$%&/()=?}][{@#*+'

$password = Scramble-String $password

Write-Host $password

Write-Host ""
Write-Host "Script will terminate in 20sec"

Start-Sleep 20
exit
Reply




Users browsing this thread: 1 Guest(s)