PowerShell 技能连载 - 生成随机密码

以下是一个非常简单的创建复杂随机密码的方法:

1
2
3
4
Add-Type -AssemblyName System.Web
$PasswordLength = 12
$SpecialCharCount = 3
[System.Web.Security.Membership]::GeneratePassword($PasswordLength, $SpecialCharCount)

The API call lets you choose the length of the password, and the number of non-alphanumeric characters it contains.

本文国际来源:Generating Random Passwords

评论