<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>generate strong passwords Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/generate-strong-passwords/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/generate-strong-passwords/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Thu, 17 Dec 2020 09:31:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>Powershell Random Password Generator</title>
		<link>https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/</link>
					<comments>https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Wed, 03 Apr 2019 05:57:05 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[generate strong passwords]]></category>
		<category><![CDATA[powershell generate alphanumeric password]]></category>
		<category><![CDATA[powershell generate password without special characters]]></category>
		<category><![CDATA[powershell generate random string]]></category>
		<category><![CDATA[powershell generatepassword]]></category>
		<category><![CDATA[Powershell Password Generator]]></category>
		<category><![CDATA[Powershell Password script]]></category>
		<category><![CDATA[powershell random password generator]]></category>
		<category><![CDATA[strong random password]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=1535</guid>

					<description><![CDATA[<p>I Love it! Powershell really can do a lot of cool things and this handy little function comes in for the clutch when creating new user accounts or just resetting a user&#8217;s password. Today I&#8217;m going to share with you&#8230; <a href="https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/">Powershell Random Password Generator</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I Love it!  Powershell really can do a lot of cool things and this handy little function comes in for the clutch when creating new user accounts or just resetting a user&#8217;s password.  Today I&#8217;m going to share with you a simple, yet effective <strong>Powershell Random Password Generator</strong>.  I know there are a ton of websites out there that can provide this functionality but this method allows you to programmatically generate passwords for easier automation.</p>
<p>A great use case for this random password generator script would be to generate a strong random password for an account creation.  This way you have everything setup in your script without having to manually ping a website elsewhere. This script shall be called <strong>New-RandomPassword</strong>.</p>
<h2>How The Random Password Generator Powershell Script Works</h2>
<p>Essentially what this script does is take a number and pass it as a character data type.  This is accomplished within Powershell by typing <strong>[char] <em>SomeNumber</em></strong>.  For example if you type: [char]35 , it should return a hash sign.  To get a full list of number to characters simply run line 1 in Powershell. </p>
<pre class="brush: powershell; title: ; notranslate">
33..126 | foreach {Write-Host &quot;$_ = $([char]$_)&quot;}
#Output below
33 = !
34 = &quot;
...
120 = x
121 = y
122 = z
</pre>
<h2>Powershell Random Password Generator</h2>
<p>There are a couple of caveats that you should be aware of so I&#8217;ll note them here.  Since there are no duplicate characters allowed, each character is only used one time.  Also, since there only so many characters available the max limit, per the script, is currently at 79.</p>
<h3>Script Requirements</h3>
<ul>
<li>There are no requirements but you should be using Powershell 5 or greater</li>
</ul>
<h3>Parameters</h3>
<h3>    -Length</h3>
<p>Description: This will specify the amount of characters you want to output. Valid ranges are 5 to 79 and the default is currently set to 16.</p>
<h3>    -ExcludeSpecialCharacters</h3>
<p>Description: Special Characters include: <strong>!#$%&#038;*+,<=>?@[\]^</strong> . When this switch is called, these characters will not be in the output</p>
<h3>Examples</h3>
<p><strong>Example 1: New-RandomPassword</strong><br />
<strong>Example 2: New-RandomPassword -Length 20</strong><br />
<strong>Example 3: New-RandomPassword -Length 20 -ExcludeSpecialCharacters</strong></p>
<pre class="brush: powershell; title: ; notranslate">
Function New-RandomPassword { 
&lt;#
.Synopsis
    This will generate a new password in Powershell using Special, Uppercase, Lowercase and Numbers.  The max number of characters are currently set to 79.
    For updated help and examples refer to -Online version.


.NOTES   
    Name: New-RandomPassword
    Author: theSysadminChannel
    Version: 1.0
    DateCreated: 2019-Feb-23


.LINK 
    https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/ -


.EXAMPLE
    For updated help and examples refer to -Online version.

#&gt;

    [CmdletBinding()]
    param(
        [Parameter(
            Position = 0,
            Mandatory = $false
        )]
        [ValidateRange(5,79)]
        [int]    $Length = 16,

        [switch] $ExcludeSpecialCharacters

    )


    BEGIN {
        $SpecialCharacters = @((33,35) + (36..38) + (42..44) + (60..64) + (91..94))
    }

    PROCESS {
        try {
            if (-not $ExcludeSpecialCharacters) {
                    $Password = -join ((48..57) + (65..90) + (97..122) + $SpecialCharacters | Get-Random -Count $Length | foreach {[char]$_})
                } else {
                    $Password = -join ((48..57) + (65..90) + (97..122) | Get-Random -Count $Length | foreach {[char]$_})
            }

        } catch {
            Write-Error $_.Exception.Message
        }

    }

    END {
        Write-Output $Password
    }

}

</pre>
<p>&nbsp;</p>
<p>Here is what the specified output would look like.<br />
<a href="https://thesysadminchannel.com/wp-content/uploads/2019/07/New-RandomPassword-Examples.png" target="_blank" rel="noopener noreferrer"><img fetchpriority="high" decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2019/07/New-RandomPassword-Examples.png" alt="Powershell Random Password Generator" width="1119" height="512" class="aligncenter size-full wp-image-1537" srcset="https://thesysadminchannel.com/wp-content/uploads/2019/07/New-RandomPassword-Examples.png 1119w, https://thesysadminchannel.com/wp-content/uploads/2019/07/New-RandomPassword-Examples-1024x469.png 1024w, https://thesysadminchannel.com/wp-content/uploads/2019/07/New-RandomPassword-Examples-768x351.png 768w" sizes="(max-width: 1119px) 100vw, 1119px" /></a></p>
<p>Hopefully you will have a chance to use this script in your work flow or automation.  Personally, I use this function on a weekly basis for whenever I need to generate strong passwords longer than 20 characters.  Anytime I need to sign up for a new service, New-RandomPassword -Length 20 is all I need to do for the password portion.  I love it.</p>
<p>If you like these kinds of Powershell Posts, be sure to check our <a href="https://thesysadminchannel.com/powershell/" rel="noopener noreferrer" target="_blank">Powershell repo</a> full of real world scripts like this one that you can make use of.  While you&#8217;re at, don&#8217;t forget to check out our <a href="https://www.youtube.com/c/theSysadminChannel" rel="noopener noreferrer" target="_blank">YouTube Channel</a> for sysadmin video content I&#8217;m sure you&#8217;ll love too.</p>
<p>The post <a href="https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/">Powershell Random Password Generator</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/generate-strong-random-passwords-using-powershell/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1535</post-id>	</item>
	</channel>
</rss>
