$LongueurPassword = 20 $password = 'bcdefghkmnprstuvxyBCDEFGHKMNPRSTUVXY123456789*!-/' #$password = 'abcdefghiklmnoprstuvwxyzABCDEFGHKLMNOPRSTUVWXYZ1234567890*!-/' #!"ยง$%&/()=?}][{@#*+' $ZePassword = "" for ($MonCompteur = 1; $MonCompteur -le $LongueurPassword; $MonCompteur++){ $anumber = get-random -minimum 0 -maximum ($($password.Length)-1) #write-host $password.substring($anumber, 1) $ZePassword = "$ZePassword" + $password.substring($anumber, 1) } Write-Host $ZePassword