In this blog post I will show you my project for generating passwords with PowerShell. The goal is to develop a password generator which outputs an account name and the corresponding password and stores it in the clipboard.
Objective
When I execute this command, a password is generated and output along with the account name. It is also saved to the clipboard.
Generate-Password -Account patrick.gruenauer@domain.com -Length 14
This leads to the following output.
Download
Interested to get this function?
Then copy the lines below to PowerShell ISE or VS Code and run it. The module is then saved to the Modules folder and you can immediately start generating passwords with PowerShell.
Start-BitsTransfer `
-Source https://patrick6649.files.wordpress.com/2021/10/generate-password.zip `
-Destination $home\documents\generate-password.zip
New-Item `
-ItemType Directory `
-Path $env:PSModulePath.Split(';')[1] `
-Name Generate-Password
Expand-Archive `
-Path $home\documents\generate-password.zip `
-DestinationPath "$($env:PSModulePath.Split(';')[1] + '\Generate-Password')"
Now type Generate-Password and provide an account name as well as the desired length of your password.
Have fun!
Categories: PowerShell