I always use following function to generate an automatic password.
You can set all specifications in the funtion for the needed password to be created
Function Create-Password {
$passwoord = New-Object system.random
#How many characters in the password
[int]$passwordlength = 8
##Make sure that number of characters below are not greater than $passwordlength!!
#Minimum Upper Case characters in password
[int]$min_upper = 2
#Minimum Lower Case characters in password
[int]$min_lower = 2
#Minimum Numerical characters in password
[int]$min_number = 2
#Misc password characters in password
[int]$min_misc = ($passwordlength - ($min_upper + $min_lower + $min_number))
#Characters for the password
$upper = @("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
$lower = @("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
$number = @(1,2,3,4,5,6,7,8,9,0)
#$symbol = @("!","@","#","%","&","(",")","`"",".","<",">","+","=","-","_")
$combine = $upper + $lower + $number + $symbol
$password = @()
#Start adding upper case into password
1..$min_upper | % {$password += Get-Random $upper}
#Add lower case into password
1..$min_lower | % {$password += Get-Random $lower}
#Add numbers into password
1..$min_number | % {$password += Get-Random $number}
#Add symbols into password
#1..$min_symbol | % {$password += Get-Random $symbol}
#Fill out the rest of the password length
1..$min_misc | % {$password += Get-Random $combine}
#Randomize password
Get-Random $password -count $passwordlength | % {[string]$randompassword += $_}
Return $randompassword
}