Advertisement
compu_85

Password Generator

Jun 24th, 2016
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Generates Passphrases
  2. # Stolen from http://www.hanselman.com/blog/DictionaryPasswordGeneratorInPowershell.aspx
  3. #
  4.  
  5. $rand = new-object System.Random
  6. $conjunction = "The","My","We","Our","And","But","For","So","Not","To","Any"
  7. $special = "%","*","+","&","."
  8. $number = "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"
  9. $separator = ",","-","_","."
  10. $words = Get-Content '\\mbrnysmith01\it_folders\TOOLS\Scripts\wordlist.txt'
  11.  
  12. for ($ii = 1; $ii -le 30; $ii++){
  13.     $word1 = ($words[$rand.Next(0,$words.Count)])
  14.     $con = ($conjunction[$rand.Next(0,$conjunction.Count)])
  15.     $word2 = ($words[$rand.Next(0,$words.Count)])
  16.     $num = ($number[$rand.Next(0,$number.Count)])
  17.     $sep1 = ($separator[$rand.Next(0,$separator.Count)])
  18.     $sep2 = ($separator[$rand.Next(0,$separator.Count)])
  19.     $sc = ($special[$rand.Next(0,$special.Count)])
  20.    
  21.     #return $word1 + " " + $con + " " + $word2
  22.    
  23.     $result = $word1 + $sep1 + $con + $sep1 + $word2 + $sc + $num
  24.  
  25.     Write-Host $result
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement