GithubHelp home page GithubHelp logo

rhymeswithmogul / pspasswordgenerator Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 392 KB

A PowerShell module to generate passwords as random as you want them.

License: GNU Affero General Public License v3.0

PowerShell 100.00%
powershell powershell-module powershell-modules powershell-core pwsh password password-generator passwords windows-powershell passcode

pspasswordgenerator's Introduction

PowerShell Gallery Version (including pre-releases) PowerShell Gallery

PowerShell PSPasswordGenerator Module

This module provides a convenient way to generate passwords that are at most as cryptographically secure as the Get-Random cmdlet's source of entropy can provide.

Installation

You can install the PSPasswordGenerator module from the PowerShell Gallery:

Install-Module [-Name] PSPasswordGenerator [-Repository PSGallery]

Or, do a git clone into your ${env:PSModulePath} and work with the latest development version.

This module is compatible with PowerShell 7, and it will be compatible with the legacy version of Windows PowerShell 5.1 for as long as possible.

Usage

By default, this cmdlet returns password as a SecureString object. This is great for PowerShell scripting, as the password is protected in memory. For example, you could build a PSCredential object with the highest entropy possible that's still compatible with Active Directory Domain Services. This is a way to configure a Windows Server DHCP Server service.

PS> Import-Module PSPasswordGenerator
PS> $passwd = Get-RandomPassword -Length 240 -UseExtendedAscii -UseAmbigiousCharacters
PS> $credentials = [Management.Automation.PSCredential]::new('DOMAIN\_ServiceAccount', $passwd)

PS> Import-Module DHCPServer
PS> Set-DHCPServerDNSCredential -Credential $credentials

However, in many cases, you might be using this module to generate random passwords for use outside of PowerShell. In that case, supply the -AsPlainText parameter. (As this is a valid use, I won't make you also include the -Force parameter.)

PS> Get-RandomPassword -Length 32 -AsPlainText
i%eS+R5y4q^4wZ#E>(kNCKuU]R}hQZ"H

Or, you can make something secure but a lot more human-friendly with the new word list support! (BYO wordlist.)

PS> Get-RandomPassword -Words 3 -WordList 'my-wordlist.txt'
illustration.Mainspring"Muleteer

Then, copy and paste that into whatever service or device is asking for a password.

Disclaimers

This module is not developed, endorsed, or known by Microsoft.

pspasswordgenerator's People

Contributors

rhymeswithmogul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hariprasad-1999

pspasswordgenerator's Issues

Enhancement Request - Add an Exclude Parameter

When making passwords with the command, some systems specify certain characters cannot be used. I ran into this issue when using the command to make a password for my hypervisor.

I am imaging a list of symbols in an exclude switch/parameter.

Get-RandomPassword -length 20 -exclude %[$

Avoid using ConvertTo-SecureString -AsPlainText

Codacy detected an issue:

Message: File 'PSPasswordGenerator.psm1' uses ConvertTo-SecureString with plaintext. This will expose secure information. Encrypted standard strings should be used instead.

We're building the password in plain text in memory, before converting it to a SecureString. There's got to be a better way.

Occurred on:

Currently on:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.