@Alejandro Miranda, Thanks for the reply. For the prompt "The user's password must be changed before signing in", it seems the "User must change password at next logon" is enabled.
Based on my test, we need to change the user password before we unselect "User must change password at next logon". You can add the PowerShell commands in the script to firstly change the local user password before we disable the setting. here is a link with detailed commands for your reference.
Hope the above information can help.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.