PowerShell - User Must Change Password at Next Logon

心已入冬 提交于 2021-01-23 09:00:13

问题


Here is what I have, everything works great thus far except the part where I need the user to change their password on sign in

Import-Csv C:\Users\user\Desktop\newuser.csv | New-ADUser -PassThru | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText '@To03PXaz4' -Force) -PassThru | Enable-ADAccount -PassThru | Set-Aduser -ChangePasswordAtNextLogon $true

any guidance would be greatly appreciated


回答1:


The syntax is -ChangePasswordAtLogon, not -ChangePasswordAtNEXTLogon. See https://technet.microsoft.com/en-us/library/hh852287(v=wps.630).aspx

Using Set-Aduser -ChangePasswordAtLogon $true should fix your problem.




回答2:


that's what worked for me:

Set-AdUser -ChangePasswordAtLogon:$true

Note: take care of ":" before true



来源:https://stackoverflow.com/questions/46493181/powershell-user-must-change-password-at-next-logon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!