PowerShell - 用户必须在下次登录时更改密码

PowerShell - User Must Change Password at Next Logon

这是我所拥有的,到目前为止一切都很好,除了我需要用户在登录时更改密码的部分

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

任何指导将不胜感激

语法是-ChangePasswordAtLogon,不是-ChangePasswordAtNEXTLogon。参见 https://technet.microsoft.com/en-us/library/hh852287(v=wps.630).aspx

使用 Set-Aduser -ChangePasswordAtLogon $true 应该可以解决您的问题。

这对我有用:

Set-AdUser -ChangePasswordAtLogon:$true

注意:注意 true 前的“:”