+ CategoryInfo : InvalidData: (TA-SRV-INB**-****-*:ADAccount) [Set-ADAccountPassword], ADInvalidPasswordException + FullyQualifiedErrorId : The specified network password is not correct,Microsoft.ActiveDirectory.Management.Commands.SetADAccountPassword
我在执行PowerShell脚本以重置其中一个帐户的密码时遇到上述错误。
答案 0 :(得分:0)
首先验证旧密码。并确保您的新密码符合密码复杂性要求。
$AccountName='Account Name'
$OldPassword ='Old Password'
$NewPassword='New Password'
# Verifying password
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain')
$Validate = $DS.ValidateCredentials($AccountName, $Password)
#Password Change
Set-ADAccountPassword -Identity "$AccountName" -OldPassword (ConvertTo-SecureString -AsPlainText $OldPassword -Force) -NewPassword (ConvertTo-SecureString -AsPlainText $NewPassword -Force)
希望这个HElps。