$TokenSet = @{ U = [Char[]]'ABCDEFGHIJKLMNOPQRSTUVWXYZ' L = [Char[]]'abcdefghijklmnopqrstuvwxyz' N = [Char[]]'0123456789' S = [Char[]]'!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~' } $Upper = Get-Random -Count 5 -InputObject $TokenSet.U $Lower = Get-Random -Count 5 -InputObject $TokenSet.L $Number = Get-Random -Count 5 -InputObject $TokenSet.N $Special = Get-Random -Count 5 -InputObject $TokenSet.S $StringSet = $Upper + $Lower + $Number + $Special $RdString = (Get-Random -Count 15 -InputObject $StringSet) -join '' #You can use now $RdString in your script to make a random password to an AD user or other stuff...