标签:
重置密码脚本v0.1
param( [Parameter(Mandatory=$true)] [string]$aduser ) Function random-password ($length = 8) { $punc = 33..47 #特殊字符 $digits = 48..57 #0-9数字 $letters = 65..90 + 97..122 #大小写字母 $password = get-random -count $length -input ($punc + $digits + $letters) | % -begin { $aa = $null } -process {$aa += [char]$_} -end {$aa} return $password } $pwd = random-password #$pwd get-aduser $aduser | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "$pwd" -Force) echo $aduser,$pwd
标签:
原文地址:http://www.cnblogs.com/winlin/p/5892849.html