Randompwd.ps1
<#PSScriptInfo .VERSION 1.0 .GUID b2bddb37-978d-4e8a-bb40-a1f504c42bb8 .AUTHOR fejshell .COMPANYNAME .COPYRIGHT .TAGS .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES .PRIVATEDATA #> <# .DESCRIPTION This script will allow you define the length and number of non-alphanumeric characters for a random password #> Param() function RandomPassword { param ( [int]$Length = 16, [int]$Symbol = 4 ) # Load the System.Web assembly if not already loaded if (-not ([System.Reflection.Assembly]::GetAssembly([System.Web.Security.Membership]))) { Add-Type -AssemblyName System.web } # Generate and return the password $password = [System.Web.Security.Membership]::GeneratePassword($Length, $Symbol) return $password } |