Home » Office 365 » Set-MsolUserPassword – Reset the Password for a User

Set-MsolUserPassword – Reset the Password for a User

The Set-MsolUserPassword cmdlet in PowerShell resets the password for a user in Microsoft Office 365. This command can only be used for users with standard identities.

The syntax to reset the password for a user in Azure Active Directory is given below.

Set-MsolUserPassword
   -ObjectId <Guid>
   -UserPrincipalName <String>
   [-NewPassword <String>]
   [-ForceChangePassword <Boolean>]
   [-ForceChangePasswordOnly <Boolean>]
   [-TenantId <Guid>]
   [<CommonParameters>]

In this article, we will discuss how to use the Set-MsolUserPassword cmdlet in PowerShell to reset the password with a random password for a user, reset the password with a random password.

How to Reset the Password with Random Password for a User in Office 365

To reset the password with a random password for a user in Office 365, use the Set-MsolUserPassword cmdlet in PowerShell.

This command uses the -UserPrincipalName parameter to specify the user’s principal name and the -ForceChangePassword parameter to indicate whether the user must change the password the next time they sign in.

Set-MsolUserLicense -UserPrincipalName "[email protected]" -ForceChangePassword 

This command resets the password for a user “[email protected]“. This command generates a random password. The user “bob” is required to change the password on the next sign-in.

How to Reset Password for a User in Office 365

To reset the password for a user in Office 365, use the Set-MsolUserPassword cmdlet with the -NewPassword parameter. The -NewPassword parameter specifies the new password for a user.

Set-MsolUserLicense -UserPrincipalName "[email protected]" -NewPassword "WelcomeP@$word2"

This command resets the password for the user “[email protected]“. The user will be required to reset the password on the next sign-in.

Conclusion

I hope the above article on how to use the Set-MsolUserPassword cmdlet in PowerShell to reset the password for the user in Office 365 is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Set-MsolUserLicense

Set-MsolUserPrincipalName