Make Passwords In PowerShell With DinoPass

Photo by Larkin Hammond on Unsplash

So, you want to generate a secure password in PowerShell using DinoPass?

Do I ever have a quick guide for you? 

This is one of the simplest operations you can do in PowerShell. Typically, generating secure passwords in PowerShell requires a lot of code and error checking. 

Before I show you the method of getting passwords from DinoPass, I wanted to show the two methods I’ve used in the past.

They’re a lot more work but they are obviously better if you don’t have an internet connection when generating passwords.


Method 1

The first, worse and oldest method, consists of basically picking a number of random chars:

[string]$initialpassword = ([char[]](Get-Random -input $(47..57 + 65..90 +97..122) -count 8)) + (Get-Random -minimum 0 -maximum 10)

$passwordwithspacesremoved = $initialpassword.Replace(' ','')

$convertedpassword = ConvertTo-SecureString -AsPlainText $passwordwithspacesremoved -Force

As you can see, this is FAR from ideal!


Method 2

The second method is to use the built in [System.Web.Security.Membership]::GeneratePassword() fuction.

What’s great about this function is that it allows you to specify both the password length and the number of alphanumerical characters you need. 

So if I wanted a password that was 10 characters long and included 5 alphanumerical characters, I would use:

Add-Type -AssemblyName 'System.Web'
[System.Web.Security.Membership]::GeneratePassword(10,5)

If I had to chose between method 1 and method 2, I would obviously chose method 2. 


DinoPass Method

Now lets move onto the God tier of password generation in PowerShell.

We can leverage the public password generator from DinoPass. The DinoPass generation is amazing, it provides easy to read and remember passwords that are perfect for new users and service accounts.

As you need, is to use the Invoke-WebRequest built into PowerShell.

So if I wanted a secure password from DinoPass, I would use:

Invoke-WebRequest -Uri https://www.dinopass.com/password/strong | Select-Object -ExpandProperty content

As an example, this returns: sh!nyWolf84

You can also use their simple password generator, giving you flexibility in the type of password that is returned:

Invoke-WebRequest -Uri https://www.dinopass.com/password/simple | Select-Object -ExpandProperty content

As an example, this returns: hugefawn22

I hope this has helped someone, using the DinoPass password generator API is still my preferred way of generating passwords inside scripts.

Enjoy! 🎉

3 thoughts on “Make Passwords In PowerShell With DinoPass”

  1. puravive reviews

    Fantastic site A lot of helpful info here Im sending it to some buddies ans additionally sharing in delicious And naturally thanks on your sweat

  2. Fantastic site Lots of helpful information here I am sending it to some friends ans additionally sharing in delicious And of course thanks for your effort

Leave a Comment

Your email address will not be published. Required fields are marked *

email popup image
Mark Harwood
NEVER miss a blog post again! Subscribe for email notifications whenever a new post is live!
Subscribe
NEVER miss a blog post again! Subscribe for email notifications whenever a new post is live!
Fill Out This Form, And I Will Be In Touch Shortly
Contact form image
I'll Be In Touch Soon