generating random password without special characters

Welcome Forums General PowerShell Q&A generating random password without special characters

Viewing 3 reply threads
  • Author
    Posts
    • #237643
      Participant
      Topics: 11
      Replies: 9
      Points: 110
      Rank: Participant

      Hi All
      I am using below code to generate random password .

      random password generated from above function is b}0-ad.GqCz:e>!
      how can i avoid generating special characters like “{” , “}” , please suggest.
    • #237652
      Participant
      Topics: 11
      Replies: 9
      Points: 110
      Rank: Participant
      i used below function and it worked thanks
    • #237658
      Participant
      Topics: 7
      Replies: 121
      Points: 587
      Helping Hand
      Rank: Major Contributor

      I think all you can do is delete or replace those characters after generating the password. The GeneratePassword method only accepts 2 arguments, length and number of non alpha numeric characters.

      This link might help:

      https://stackoverflow.com/questions/30215047/how-to-remove-curly-braces-from-string-in-powershell

       

    • #237673
      Participant
      Topics: 6
      Replies: 552
      Points: 2,090
      Helping Hand
      Rank: Community Hero

      There are many homegrown password generators. You could take this fine example and just remove the characters/charactersets you don’t want.

      https://gist.github.com/Jaykul/5cb0410abd40672707faf67549404ea8

Viewing 3 reply threads
  • You must be logged in to reply to this topic.