

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to generate a strong password using PowerShell?
To generate a strong password with the PowerShell, we can use 8 or more characters password. In the below example, we are going to use the 8 character password, you can change the number of characters as per your convenience.
This script you can bind into windows forms and provide it to the IT helpdesk to set the password for new users.
In this example, we will use the Random integers between 33 and 126 and convert it to the Character, considering them they are the ASCII values for characters.
You can find more about ASCII values in the table provided in the link.
https://www.rapidtables.com/code/text/ascii-table.html
Now we will see the explanation of the script and then finally write the script.
To get the random numbers between 33 and 126, Get-Random command is used.
Get-Random -Minimum 33 -Maximum 126
Once, you get the number, translate it into character by type conversion.
[char](Get-Random -Minimum 33 -Maximum 126)
We have not a single character, but we need 8 characters long password so you need to loop above commands 8 times and append each character to the previous character.
Example
[int]$passlength = 8 [string]$pass for($i=0; $i -lt $passlength; $i++){ $pass += [char](Get-Random -Minimum 33 -Maximum 126) } $pass
Output
EGS)^&hf
- Related Questions & Answers
- Strong Password Checker in Python
- How to generate an HTML report using PowerShell?
- How can we generate Strong numbers in Python?
- How to change the local user account password using PowerShell?
- How to generate multiple reports in HTML using PowerShell?
- C++ Program to check whether given password is strong or not
- PHP program to generate a numeric one-time password
- How to use Boto3 to generate a random password in AWS Secret Manager
- Explain secure password Encryption with PowerShell.
- How to create a password field using JavaFX?
- How to create a password entry field using Tkinter?
- Validating a password using JavaScript
- How to generate a 24bit hash using Python?
- How to generate a string randomly using C#?
- How to Choose a Secure Password?