Questo script PowerShell permette di generare una password casuale tramite l'uso del metodo Windows System.Web.Security.Membership.GeneratePassword

PowerShell

function Generate-Password {
    param (
        [Parameter(Mandatory)]
        [int] $length,
        [int] $amountOfNonAlphanumeric = 1
    )

    Add-Type -AssemblyName 'System.Web'

    return [System.Web.Security.Membership]::GeneratePassword($length, $amountOfNonAlphanumeric)
}
va usato in questo modo

PowerShell

$pwd = Generate-Password -length 20  

Write-Host $pwd
da un risultato simile a questo

Text

zvP6:-s3M};J7)fxzF1H
Tags:
PowerShell199 Script85 Utility59
Potrebbe interessarti anche: