Powershell - 强制本地用户在下次登录时更改密码

Powershell - Force local users to change password on next login

我希望有人能提供帮助。

我需要以某种方式强制本地用户在每个月的第一天更改密码。

我查看了 PS,但没有找到设置此标志的方法。 也没有通过 PS.

将其添加到 GPO 的方法

如果 PS 大师可以提供帮助,我将不胜感激。

干杯CM

已编辑!!

https://community.spiceworks.com/topic/2089854-script-to-create-local-users-on-workstation

根据上述 link 我们可以将其过期时间更改为 true,下次用户必须更改密码

$expUser = [ADSI]"WinNT://localhost/$user,user"
$expUser.passwordExpired = 1
$expUser.setinfo()

用户'USER'将要求更改密码