Create a new mailbox in Exchange Online
New-Mailbox -Alias sunil -Name "Sunil Chauhan" -FirstName Sunil -LastName Chauhan -DisplayName "Sunil Chauhan" -MicrosoftOnlineServicesID sunil@sunilchauhan.info -Password (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force) -ResetPasswordOnNextLogon $true
Delete or restore user mailboxes
Soft-deleted user mailboxes
A soft-deleted user mailbox is a mailbox that has been deleted using the Office 365 admin center or the Remove-Mailbox cmdlet in the Exchange Management Shell and has still been in the Azure active directory (Azure AD) recycle bin for less than 30 days.Hard-deleted user mailboxes
A hard-deleted user mailbox is a mailbox that has been soft-deleted for more than 30 days, and the associated Azure active directory user has been hard-deleted or was deleted using the Remove-Mailbox -PermanentlyDelete cmd.All mailbox content such as emails, contacts, and files will be permanently deleted.
Delete a user mailbox
A deleted mailbox stays in soft-deleted state for 30 days post which Mailbox is deleted permanently unless Litigation hold was not placed.Remove-Mailbox -Identity "Sunil Chauhan"
Using Azure AD shell to delete a mailbox permanently.
Restore a user mailbox
Run the following cmd to undo a mailbox deletion.
Undo-SoftDeletedMailbox sunil@sunilchauhan.info -WindowsLiveID sunil@sunilchauhan.info -Password (ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)
Restoring a user in a hybrid scenario
If the mailbox has been soft-deleted and the Azure active directory user that was associated with the mailbox has been hard-deleted from Azure Active Directory, you can use New-MailboxRestoreRequest to recover the mailbox.Retrieve the GUID for the soft-deleted mailbox that you want to restore.
$SoftDeletedMbx = get-mailbox Sunil -SoftDeletedMailbox
This cmdlet will return a GUID of soft-deleted mailboxes.
Run the following cmdlet to restore the mailbox.
New-MailboxRestoreRequest -SourceMailbox $SoftDeletedMbx.Guid -TargetMailbox <GUID from new target mailbox you've created>
Comments
Post a Comment