Password Generator in powershell

Welcome Forums General PowerShell Q&A Password Generator in powershell

This topic contains 3 replies, has 3 voices, and was last updated by

2 years, 10 months ago.

  • Author
  • #40795

    Points: -19
    Rank: Member

  • #40799

    Points: -19
    Rank: Member

    I am trying to create a password generator in powershell

    The problem is when I run the function the results are not always predictable

    For example:
    get-randompassword -UppercaseAlphachracters 1 -LowercaseAlphaChracters 1 -SpecialChracters 1 -NumericChracters 5

    most of the time it gives me the amount I have requested:
    5 numeric chracters
    etc etc...

    other times it is one less that the specified values.

    what am I missing here?

  • #40806

    Points: 0
    Rank: Member

    While its awesome that you're playing around and making your own scripts, you can generate random passwords in PowerShell with a single line.

    Add-Type -AssemblyName System.Web

    In this line of code, the '5' indicates the Number of non alphanumeric characters while the '12' indicates the password Length.

  • #40828

    Points: 1
    Rank: Member

    Have a look t this:

    -join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_})

    It could make this mutch easier.

The topic ‘Password Generator in powershell’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort