in this blog post, I will share with you a script that will generate a very secure password using PowerShell.
About the script
The script will generate a password with the following criteria:
- 20 characters password
- 3 non-alphanumeric characters
- Minimum two numbers
You can change the above criteria by changing the variables in the script.
Script
Add-Type -AssemblyName 'System.Web' $passlength = 20 $nonalpha = 3 do { $password = [System.Web.Security.Membership]::GeneratePassword($passlength, $nonlpha) } until ($password -match '\d\d') "Your random password is: " + $password
You can see the output of the script below.
Processing…
Success! You're on the list.
Whoops! There was an error and we couldn't process your subscription. Please reload the page and try again.