Advertisement
Guest User

svettosten

a guest
Sep 16th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Generate a random string
  2. Function Get-RandomAlphanumericString {
  3.    
  4.     [CmdletBinding()]
  5.     Param (
  6.         [int] $length = 8
  7.     )
  8.  
  9.     Begin{
  10.     }
  11.  
  12.     Process{
  13.         Write-Output ( -join ((0x30..0x39) + ( 0x41..0x5A) + ( 0x61..0x7A) | Get-Random -Count $length  | % {[char]$_}) )
  14.     }  
  15. }
  16.  
  17. param (
  18.     [string]$username = "username",
  19.     [string]$password = $( Get-RandomAlphanumericString -length 16 )
  20. )
  21.  
  22. Write-Output "$password"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement