Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $newp = ''
- $passlen = 7
- 1..$passlen | `
- foreach `
- {
- switch (Get-Random -Minimum 0 -Maximum 3)
- {
- 0 { $newp += [char](Get-Random -Minimum 0x30 -Maximum 0x39) }
- 1 { $newp += [char](Get-Random -Minimum 0x41 -Maximum 0x5a) }
- 2 { $newp += [char](Get-Random -Minimum 0x61 -Maximum 0x7a) }
- }
- }
- " "; $newp; " "
- # Next approach maybe better, will try it sometime :-)
- # $rand = New-Object System.Random
- #
- # $NewPassword += [char]$rand.next(65,90)
- # [...]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement