Windows 11 local user, force password change on login

Posted by theslats@reddit | sysadmin | View on Reddit | 4 comments

For many years this was accomplished with

net user $user /logonpasswordchg:yes

or

$user = [ADSI]"WinNT://$env:ComputerName/LocalUserName,user" 
$user.PasswordExpired = 1 
$user.SetInfo()

These do not seem to work any more. Is there a newer solution?