Set-MsolUserPassword
Resets the password for a user.
Syntax
Set-MsolUserPassword
-ObjectId <Guid>
[-NewPassword <String>]
[-ForceChangePassword <Boolean>]
[-ForceChangePasswordOnly <Boolean>]
[-TenantId <Guid>]
[<CommonParameters>]
Set-MsolUserPassword
[-NewPassword <String>]
[-ForceChangePassword <Boolean>]
[-ForceChangePasswordOnly <Boolean>]
-UserPrincipalName <String>
[-TenantId <Guid>]
[<CommonParameters>]
Description
The Set-MsolUserPassword cmdlet resets the password of a user. This cmdlet can only be used for users with standard identities.
Examples
Example 1: Reset a password with a random password
PS C:\> Set-MsolUserPassword -UserPrincipalName "davidchew@contoso.com" -ForceChangePassword
This command resets the password for davidchew@contoso.com. The cmdlet generates a random password. The user is required to reset the password on next sign in.
Example 2: Reset a password
PS C:\> Set-MsolUserPassword -UserPrincipalName "davidchew@consoso.com" -NewPassword "pa$$word"
This command resets the password for davidchew@contoso.com. The user will be required to reset the password on next sign in.
Parameters
-ForceChangePassword
Indicates whether the user must change the password the next time they sign in.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ForceChangePasswordOnly
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-NewPassword
Specifies a new password for the user. If the user is set to require a strong password, then all of the following rules must be met:
- The password must contain at least one lowercase letter
- The password must contain at least one uppercase letter
- The password must contain at least one non-alphanumeric character
- The password cannot contain any spaces, tabs, or line breaks
- The length of the password must be 8-16 characters
- The user name cannot be contained in the password
If you do not specify a password, the cmdlet generates a random password for the user.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectId
Specifies the unique ID of the user for which to set the password.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TenantId
Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-UserPrincipalName
Specifies the user principal name of the user for which to set the password.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |