internal/functions/New-Password.ps1
function New-Password { <# .SYNOPSIS Password Generator .DESCRIPTION Password Generator .EXAMPLE New-Password Generates new password. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] [CmdletBinding()] param ( ) $Alphabets = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z' $numbers = 0..9 $specialCharacters = "!,#,),+,@,_" $array = @() $array += $Alphabets.Split(',') | Get-Random -Count 4 $array[0] = $array[0].ToUpper() $array[-1] = $array[-1].ToUpper() $array += $numbers | Get-Random -Count 3 $array += $specialCharacters.Split(',') | Get-Random -Count 3 return ($array | Get-Random -Count $array.Count) -join "" } |