Restore-MsolUser

Restores a deleted user.

Syntax

Restore-MsolUser
       -ObjectId <Guid>
       [-AutoReconcileProxyConflicts]
       [-NewUserPrincipalName <String>]
       [-TenantId <Guid>]
       [<CommonParameters>]
Restore-MsolUser
       [-AutoReconcileProxyConflicts]
       [-NewUserPrincipalName <String>]
       -UserPrincipalName <String>
       [-TenantId <Guid>]
       [<CommonParameters>]

Description

The Restore-MsolUser cmdlet restores a user that is in the Deleted users view to its original state. Deleted users remain in the Deleted users view for 30 days.

Examples

Example 1: Restore a user

PS C:\> Restore-MsolUser -UserPrincipalName "davidchew@contoso.com"

This command restores the user "davidchew@contoso.com" from the Deleted users container to the Active users container.

Example 2: Restore a user and remove conflicts

PS C:\> Restore-MsolUser -UserPrincipalName "davidchew@contoso.com" -AutoReconcileProxyConflicts

This command restores the user davidchew@contoso.com from the Deleted users container to the Active users container, removing any conflicting proxy addresses. Use this option if restore fails due to proxy conflicts.

Example 3: Restore a user

PS C:\> Restore-MsolUser -UserPrincipalName "davidchew@contoso.com" -NewUserPrincipalName "davidchew02@contoso.com"

This command restores the user davidchew@contoso.com from the Deleted users container to the Active users container as davidchew02@contoso.com. Use this option if restore fails due to a user principal name conflict.

Parameters

-AutoReconcileProxyConflicts

Indicates that any proxy addresses that cause conflicts are removed for the user. Specify this parameter if one or more of the proxy addresses of the user is also used for another active user.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-NewUserPrincipalName

Specifies a new user principal name to use when restoring the user. Specify this parameter if the original user principal name of the user is in use by another active user.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ObjectId

Specifies the unique Object ID of the user to restore.

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 ID of the user to restore.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False