Restore-MsolUser
Updated: July 30, 2015
Applies To: Azure, Office 365, Windows Intune
Note
- The cmdlets were previously known as the Microsoft Online Services Module for Windows PowerShell cmdlets.
This cmdlet restores a user that is in the Deleted users view to their original state. Users will remain in the Deleted users view for 30 days.
Syntax
Restore-MsolUser [-AutoReconcileProxyConflicts] [-NewUserPrincipalName <string>] [-ObjectId <Guid>] [<CommonParameters>]
Parameters
-AutoReconcileProxyConflicts [<SwitchParameter>]
If set, then any proxy addresses that cause conflicts will be removed
for the user. This parameter should be used if one or more of the
user's proxy addresses is also used for another active user.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-NewUserPrincipalName <string>
The UserPrincipalName to use when restoring the user. This should be
used if the original UserPrincipalName of the user is in use by
another active user.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ObjectId <Guid>
The ObjectId of the user to restore.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-UserPrincipalName <string>
The user ID of the user to restore.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".
Examples
The following commands will restore a user that was deleted. The user principal name of the deleted user is FSlattery@contoso.com. The first command maps the variable $DelUser to the deleted user. The second command restores the deleted user.
$DelUser = Get-MsolUser -UserPrincipalName FSlattery@contoso.com -ReturnDeletedUsers
Restore-MsolUser -ObjectId $DelUser.ObjectId
Additional Resources
There are several other places you can get more information and help. These include: