How to force user to change password after first login when Windows is created

Anonymous
2023-08-20T13:23:27+00:00

Hello,

I have a Windows Server 2022 template in my virtulization environment, and I am trying to do this:

When the server is created and the user logs in for the first time (the very first time only), the Windows should ask the user to change the password. If I don't change, then the Windows should not allow me to advance.

I see this https://stackoverflow.com/questions/46493181/powershell-user-must-change-password-at-next-logon as an example, but this is for active directory, in which case is not like me.

Do you please help me how can I set this? Most of the results in Google are for Active Directory, but I'm not trying to enable/install that.

Can I set that in something like Task Scheduler to run one-time only and them either delete itself or be disabled?

Thanks in advance

Windows Server Identity and access User logon and profiles

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Anonymous
    2023-08-21T02:10:47+00:00

    Hello,

    In a standalone Windows setup without Active Directory, making users change their password on the first login can be a bit tricky, as it's typically tied to Active Directory. You could explore using a custom script with Task Scheduler for this. If you need help with the script, consider checking out Stack Overflow, a popular place for developers.

    Thank you for your inquiry and best of luck with your implementation.

    0 comments No comments
  2. Anonymous
    2023-09-01T06:11:32+00:00

    Hello SaeedFazlollahzadeh,

    Thank you for posting in Microsoft Community forum.

    How did you create local users on this server after the server is created?
    If you create local user accounts via "Local Users and Groups", you can check the option "User must change password at next logon" during you create local user accounts.

    I hope the information above is helpful.

    If you have any question or concern, please feel free to let us know.

    Best Regards,
    Daisy Zhou

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2024-01-05T17:32:09+00:00

    Good day to you all

    Is there a PowerShell command that can be used outside of the "User must change passwrod at next login" gui option

    0 comments No comments
  4. Anonymous
    2024-01-08T07:36:50+00:00

    Hi,

    You can set the PasswordExpired property of the ADSI object using the WinNT provider. Replace LocalUserName with your own user name.

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

    Best Regards,

    Ian Xue

    1 person found this answer helpful.
    0 comments No comments