8
0
Skriptentwickung/test/New-Password.ps1
2024-01-24 16:42:38 +01:00

33 lines
728 B
PowerShell

cls
[int]$counter = 0
[int]$count = 7
[string]$pw = $NULL
DO {
$pw += Get-Random 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
[int]$counter++ | Out-Null
$pw += Get-Random 0,1,2,3,4,5,6,7,8,9
[int]$counter++ | Out-Null
$pw += Get-Random 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
[int]$counter++ | Out-Null
$pw += Get-Random '!','§','$','%','&','/','(',')','?','#'
[int]$counter++ | Out-Null
} #end do
UNTIL (($counter -eq $count) -or ($counter -gt $count))
Write-Host $pw
#pw neu mischen
#$CA = $pw.ToCharArray()
#$SA = $CA | get-random -count $ca.length
#$output = -join $SA
$CA = $pw.ToCharArray()
$SA = $CA | get-random -count $ca.length
$output = -join $SA
Write-Host $output