{"id":2671,"date":"2018-11-02T22:11:27","date_gmt":"2018-11-02T22:11:27","guid":{"rendered":"http:\/\/microsoftgeek.com\/?p=2671"},"modified":"2018-11-02T23:10:53","modified_gmt":"2018-11-02T23:10:53","slug":"recovering-deleted-email-with-new-exchange-online-cmdlets","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=2671","title":{"rendered":"Recovering Deleted Email with New Exchange Online Cmdlets"},"content":{"rendered":"<h2 class=\"user-content_title title -h2 \">Exchange Makes It Easy for Users to Fix Deletion Mistakes<\/h2>\n<p class=\"user-content_text text \">Exchange has used a two-step item deletion process for nearly 20 years. When someone deletes an item from a mailbox, it moves into the Deleted Items folder. Later, when the user empties the Deleted Items folder, or the Managed Folder Assistant empties the folder under the instruction of a retention policy, the items go into the Recoverable Item folder. Users can rescue items from Recoverable Items using the Recover Deleted Items feature in OWA or Outlook (Figure 1).<\/p>\n<figure id=\"attachment_89995\" class=\"wp-caption alignnone\"><img class=\"_js wp-image-89995\" sizes=\"(max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI1.jpg 508w, https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI1-300x186.jpg 300w, https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI1-500x310.jpg 500w\" alt=\"Outlook Recover deleted items\" width=\"500\" height=\"310\" \/><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"user-content_text text \">When Microsoft added the Recover Deleted Items feature to Exchange 2000, the idea was to avoid administrators having to restore deleted items from backup tapes. If users made a mistake, they can fix the problem themselves.<\/p>\n<p class=\"user-content_text text \">Eventually, the Managed Folder Assistant clears deleted items out of Recoverable Items and they become irrecoverable. The exception to the rule is when items come under the control of a hold, in which case Exchange holds the items until the hold expires.<\/p>\n<h2 class=\"user-content_title title -h2 \">When Exchange Admins Rescue Users<\/h2>\n<p class=\"user-content_text text \">Although Recover Deleted Items works, it is a mechanism best suited to restoring limited numbers of items. If someone deletes a folder holding thousands of items and doesn\u2019t notice the problem, that folder and its items eventually end up in Recoverable Items and might need to be restored. Invariably, this is a problem that users are quick to escalate to look for help. Another reason why someone might seek assistance is when they cannot see the wood for the trees and cannot find the item they want by scrolling through the list presented by Recover Deleted Items.<\/p>\n<p class=\"user-content_text text \">Up to now, an admin might fix the problem by logging into the user\u2019s mailbox with OWA, find the items, and restore them. This approach works, but it means that the admin must assign themselves permission to open the user\u2019s mailbox, and that\u2019s not usually a good thing, especially when the mailbox belongs to someone who works with confidential or sensitive information.<\/p>\n<h2 class=\"user-content_title title -h2 \">Two New Cmdlets<\/h2>\n<p class=\"user-content_text text \">Exchange Online now boasts\u00a0two new cmdlets\u00a0to help.<\/p>\n<ul class=\"user-content_text text -list -unordered \">\n<li class=\"text_list-item \"><em>Get-RecoverableItems<\/em>\u00a0executes basic searches of the Deleted Items and Recoverable Items folders to find items without the need to sign into the mailbox.<\/li>\n<li class=\"text_list-item \"><em>Restore-RecoverableItems<\/em>\u00a0finds and copies items from Deleted Items or Recoverable Items to their original folders.<\/li>\n<\/ul>\n<p class=\"user-content_text text \">The basic idea is that you use\u00a0<em>Get-RecoverableItems<\/em>\u00a0to construct a search to find the desired items and then use the search as input to\u00a0<em>Restore-RecoverableItems<\/em>\u00a0when you are sure that it will process the correct items. Before trying to run these cmdlets, make sure that the account you use to sign into PowerShell holds the Exchange \u201cMailbox Import Export\u201d RBAC role.<\/p>\n<p class=\"user-content_text text \">To find out who has the role already, you can run the following command. In the example, the members of the Organization Management role group have the role as does the Administrator account.<\/p>\n<div id=\"crayon-5bdccb2709646606683836\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709646606683836-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709646606683836-2\"><span style=\"color: #99cc00;\">2<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709646606683836-3\"><span style=\"color: #99cc00;\">3<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709646606683836-4\"><span style=\"color: #99cc00;\">4<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709646606683836-5\"><span style=\"color: #99cc00;\">5<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709646606683836-6\"><span style=\"color: #99cc00;\">6<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdccb2709646606683836-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-r \">Get-ManagementRoleAssignment<\/span> <span class=\"crayon-cn\">-Role<\/span> <span class=\"crayon-s\">&#8220;Mailbox Import Export&#8221;<\/span> <span class=\"crayon-o\">|<\/span> <span class=\"crayon-r \">Format-Table<\/span> <span class=\"crayon-e\">RoleAssigneeName<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709646606683836-2\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div id=\"crayon-5bdccb2709646606683836-3\" class=\"crayon-line\"><span class=\"crayon-i\" style=\"color: #99cc00;\">RoleAssigneeName<\/span><\/div>\n<div id=\"crayon-5bdccb2709646606683836-4\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><span class=\"crayon-o\">&#8212;<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709646606683836-5\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-e\">Organization <\/span><span class=\"crayon-e\">Management<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709646606683836-6\" class=\"crayon-line crayon-striped-line\"><span class=\"crayon-i\" style=\"color: #99cc00;\">Administrator<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2 class=\"user-content_title title -h2 \">Get-RecoverableItems<\/h2>\n<p class=\"user-content_text text \">This example shows how to search a mailbox for email items (Ipm.Note) in the RecoverableItems folder.<\/p>\n<div id=\"crayon-5bdccb270964c322839173\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb270964c322839173-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdccb270964c322839173-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-r \">Get-RecoverableItems<\/span> <span class=\"crayon-cn\">-Identity<\/span> <span class=\"crayon-i\">TRedmond<\/span> <span class=\"crayon-cn\">-SourceFolder<\/span> <span class=\"crayon-i\">RecoverableItems<\/span> <span class=\"crayon-cn\">-FilterStartTime<\/span> <span class=\"crayon-s\">&#8220;2\/16\/2018 10:00:00&#8221;<\/span> <span class=\"crayon-cn\">-FilterEndTime<\/span> <span class=\"crayon-s\">&#8220;2\/16\/2018 17:00:00&#8221;<\/span> <span class=\"crayon-cn\">-FilterItemType<\/span> <span class=\"crayon-i\">Ipm<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-i\">Note<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The date\/times used in the filter are not the creation timestamp. Instead, they are when the user or the Managed Folder Assistant moved the item into its current folder. For instance, if a mailbox has a retention policy that moves items from Deleted Items into Recoverable Items after 120 days, the Managed Folder Assistant might have processed the items found by the search above at least four months ago.<\/p>\n<p class=\"user-content_text text \">A user can bypass Deleted Items and send an item direct to Recoverable Items by using the SHIFT\/Delete key combination. In this case, the\u00a0<em>LastModifiedTime<\/em>\u00a0property (used for date filters) is the date when the user executed SHIFT\/Delete.<\/p>\n<p class=\"user-content_text text \">If you want to search the Deleted Items folder instead of Recoverable Items, specify \u201cDeletedItems\u201d (these values are language independent). You cannot create a search for both the Deleted Items and Recoverable Items folders, so if you want to check the two folders, you need two separate searches. You also cannot search either folder in the archive mailbox. Likewise, you can specify different types of items to look for (like\u00a0<em>Ipm.Appointment<\/em>\u00a0for a calendar item or\u00a0<em>Ipm.Contact<\/em>\u00a0for a contact), but you cannot combine different item types in a search.<\/p>\n<p class=\"user-content_text text \">Users might not be certain when an item was deleted, but they might be able to tell you the message subject. If so, you can search like this:<\/p>\n<div id=\"crayon-5bdccb270964f999811090\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb270964f999811090-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdccb270964f999811090-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-r \">Get-RecoverableItems<\/span> <span class=\"crayon-cn\">-Identity<\/span> <span class=\"crayon-i\">Marc<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-i\">Vigneau<\/span> <span class=\"crayon-cn\">-SourceFolder<\/span> <span class=\"crayon-i\">DeletedItems<\/span> <span class=\"crayon-cn\">-SubjectContains<\/span> &#8220;<span class=\"crayon-i\">Tasks<\/span>\u201d<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Be aware that a search based on\u00a0<em>SubjectContains<\/em>\u00a0finds any item that contains the string in its subject. In this case, it will unearth items with subjects like \u201cMy Tasks\u201d and \u201cHard and Difficult Tasks\u201d and \u201cTasks 2017.\u201d<\/p>\n<p class=\"user-content_text text \">The example of the data returned for found items is shown below.<\/p>\n<div id=\"crayon-5bdccb2709651753236468\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709651753236468-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709651753236468-2\"><span style=\"color: #99cc00;\">2<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709651753236468-3\"><span style=\"color: #99cc00;\">3<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709651753236468-4\"><span style=\"color: #99cc00;\">4<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709651753236468-5\"><span style=\"color: #99cc00;\">5<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709651753236468-6\"><span style=\"color: #99cc00;\">6<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709651753236468-7\"><span style=\"color: #99cc00;\">7<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709651753236468-8\"><span style=\"color: #99cc00;\">8<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709651753236468-9\"><span style=\"color: #99cc00;\">9<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709651753236468-10\"><span style=\"color: #99cc00;\">10<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709651753236468-11\"><span style=\"color: #99cc00;\">11<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709651753236468-12\"><span style=\"color: #99cc00;\">12<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdccb2709651753236468-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">Identity<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-i\">FoTJp<\/span><span class=\"crayon-o\">+<\/span><span class=\"crayon-i\">dslCpMvzflTJoPw98AAk3A87FGAAAAAO<\/span><span class=\"crayon-o\">+<\/span>4Ga1BbPZCivtiNBUcCOEHAITJp<span class=\"crayon-o\">+<\/span><span class=\"crayon-i\">dslCpMvzflTJoPw98AAAAAARQAAITJp<\/span><span class=\"crayon-o\">+<\/span><span class=\"crayon-i\">dslCpMvzflTJoPw98AAk1<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-i\">hRYAAAk<\/span><span class=\"crayon-o\">=<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-2\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">MailboxIdentity<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-i\">Marc<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-e\">Vigneau<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-3\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">ItemClass<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-i\">IPM<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-e\">Note<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-4\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">Subject<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-e\">You <\/span><span class=\"crayon-e\">have <\/span><span class=\"crayon-e\">been <\/span><span class=\"crayon-e\">added <\/span><span class=\"crayon-i\">to<\/span> <span class=\"crayon-i\">a<\/span> <span class=\"crayon-e\">team <\/span><span class=\"crayon-st\">in<\/span> <span class=\"crayon-e\">Microsoft <\/span><span class=\"crayon-e\">Teams<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-5\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">EntryID<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> 00000000EFB819AD416CF6428AFB6234151C08E1070084C9A7E76C942A4CBF37E54C9A0FC3DF000000000114000084C9A7E76C942A4CBF37E54C9A0FC3DF00024D7F85160000<\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-6\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">SourceFolder<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-e\">Recoverable <\/span><span class=\"crayon-i\">Items<\/span><span class=\"crayon-sy\">\\<\/span><span class=\"crayon-e\">Deletions<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-7\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">LastParentFolderID<\/span>\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> 84C9A7E76C942A4CBF37E54C9A0FC3DF00000000010C<\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-8\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">LastModifiedTime<\/span>\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> 02<span class=\"crayon-o\">\/<\/span>16<span class=\"crayon-o\">\/<\/span>2018 11<span class=\"crayon-o\">:<\/span>43<span class=\"crayon-o\">:<\/span>21<\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-9\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">LastParentPath<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-i\">Bo<\/span>\u00ee<span class=\"crayon-e\">te <\/span><span class=\"crayon-i\">de<\/span> <span class=\"crayon-r \">r<\/span>\u00e9<span class=\"crayon-e\">ception<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-10\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">OriginalFolderExists<\/span> <span class=\"crayon-o\">:<\/span> <span class=\"crayon-e\">True<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-11\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">IsValid<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-e\">True<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709651753236468-12\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-i\">ObjectState<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"crayon-o\">:<\/span> <span class=\"crayon-i\">New<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Obviously, the more precise the search, the more likely you are to find the right item.<\/p>\n<h2 class=\"user-content_title title -h2 \">Recovering Items<\/h2>\n<p class=\"user-content_text text \">Once you are happy that your search finds the right items, you can proceed to recovery. The\u00a0<em>Restore-RecoverableItems<\/em>cmdlet takes the same search that you use to find items and restores each item to its original location:<\/p>\n<div id=\"crayon-5bdccb2709653012195987\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709653012195987-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdccb2709653012195987-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-r \">Restore-RecoverableItems<\/span> <span class=\"crayon-cn\">-Identity<\/span> <span class=\"crayon-i\">Marc<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-i\">Vigneau<\/span> <span class=\"crayon-cn\">-SubjectContains<\/span> <span class=\"crayon-s\">&#8220;Team&#8221;<\/span> <span class=\"crayon-cn\">-SourceFolder<\/span> <span class=\"crayon-i\">RecoverableItems<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Of course, if you wanted to, you could create your own processing loop to process a batch of mailboxes and restore the messages if any matches are in Recoverable Items (Figure 2). Here\u2019s an example:<\/p>\n<div id=\"crayon-5bdccb2709655058319290\" class=\"crayon-syntax crayon-theme-1c-zapros crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\">\n<div class=\"crayon-toolbar\" data-settings=\" show\">\n<div class=\"crayon-tools\">\n<div class=\"crayon-button crayon-nums-button crayon-pressed\" title=\"Toggle Line Numbers\"><\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\"><\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\"><\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\"><\/div>\n<p><span class=\"crayon-language\" style=\"color: #99cc00;\">PowerShell<\/span><\/p>\n<\/div>\n<\/div>\n<div class=\"crayon-plain-wrap\"><span style=\"color: #99cc00;\">\u00a0<\/span><\/div>\n<div class=\"crayon-main\">\n<table class=\"crayon-table\">\n<tbody>\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums \" data-settings=\"show\">\n<div class=\"crayon-nums-content\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709655058319290-1\"><span style=\"color: #99cc00;\">1<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709655058319290-2\"><span style=\"color: #99cc00;\">2<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709655058319290-3\"><span style=\"color: #99cc00;\">3<\/span><\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdccb2709655058319290-4\"><span style=\"color: #99cc00;\">4<\/span><\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdccb2709655058319290-5\"><span style=\"color: #99cc00;\">5<\/span><\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\">\n<div id=\"crayon-5bdccb2709655058319290-1\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-v\">$Mbx<\/span> <span class=\"crayon-o\">=<\/span> <span class=\"crayon-sy\">(<\/span><span class=\"crayon-r \">Get-Mailbox<\/span> <span class=\"crayon-cn\">-RecipientTypeDetails<\/span> <span class=\"crayon-e\">UserMailbox<\/span> <span class=\"crayon-cn\">-Filter<\/span> <span class=\"crayon-sy\">{<\/span><span class=\"crayon-i\">CustomAttribute1<\/span> <span class=\"crayon-cn\">-eq<\/span> <span class=\"crayon-s\">&#8220;IT&#8221;<\/span><span class=\"crayon-sy\">}<\/span> <span class=\"crayon-o\">|<\/span> <span class=\"crayon-r \">Select<\/span> <span class=\"crayon-i\">Alias<\/span><span class=\"crayon-sy\">,<\/span> <span class=\"crayon-i\">DisplayName<\/span><span class=\"crayon-sy\">)<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709655058319290-2\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-r \">Write-Host<\/span> <span class=\"crayon-s\">&#8220;Recovering items for&#8221;<\/span> <span class=\"crayon-v\">$Mbx<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-i\">Count<\/span> <span class=\"crayon-s\">&#8220;mailboxes&#8230;&#8221;<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709655058319290-3\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-st\">ForEach<\/span> <span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$M<\/span> <span class=\"crayon-st\">in<\/span> <span class=\"crayon-v\">$Mbx<\/span><span class=\"crayon-sy\">)<\/span> <span class=\"crayon-sy\">{<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709655058319290-4\" class=\"crayon-line crayon-striped-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-h\">\u00a0\u00a0 <\/span><span class=\"crayon-r \">Write-Host<\/span> <span class=\"crayon-s\">&#8220;Checking mailbox&#8221;<\/span> <span class=\"crayon-v\">$M<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-e\">DisplayName<\/span><\/span><\/div>\n<div id=\"crayon-5bdccb2709655058319290-5\" class=\"crayon-line\"><span style=\"color: #99cc00;\"><span class=\"crayon-e\">\u00a0\u00a0 <\/span><span class=\"crayon-r \">Restore-RecoverableItems<\/span> <span class=\"crayon-cn\">-Identity<\/span> <span class=\"crayon-v\">$M<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-i\">Alias<\/span> <span class=\"crayon-cn\">-SourceFolder<\/span> <span class=\"crayon-i\">RecoverableItems<\/span> <span class=\"crayon-cn\">-SubjectContains<\/span> <span class=\"crayon-s\">&#8220;Important and Critical Message&#8221;<\/span> <span class=\"crayon-sy\">}<\/span><\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<figure id=\"attachment_89999\" class=\"wp-caption alignnone\"><img class=\"_js wp-image-89999\" sizes=\"(max-width: 800px) 100vw, 800px\" srcset=\"https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI2.jpg 1091w, https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI2-300x171.jpg 300w, https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI2-768x439.jpg 768w, https:\/\/www.petri.com\/wp-content\/uploads\/sites\/3\/2018\/02\/RDI2-500x286.jpg 500w\" alt=\"Restore-RecoverableItems\" width=\"800\" height=\"457\" \/><\/figure>\n<p>&nbsp;<\/p>\n<h2 class=\"user-content_title title -h2 \">Automation is Good<\/h2>\n<p class=\"user-content_text text \">Anything that automates common administrative operations is goodness. In this case, these cmdlets avoid the need for administrators to sign into user mailboxes to help the owners find missing messages. And like any PowerShell cmdlets, I am sure that people will come up with some interesting methods to exploit this functionality in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exchange Makes It Easy for Users to Fix Deletion Mistakes Exchange has used a two-step item deletion process for nearly 20 years. When someone deletes an item from a mailbox, it moves into the Deleted Items folder. Later, when the user empties the Deleted Items folder, or the Managed Folder Assistant empties the folder under [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,62,73,59],"tags":[],"class_list":["post-2671","post","type-post","status-publish","format-standard","hentry","category-exchange-2013","category-microsoft-exchange-server-2016","category-exchange-server-2019","category-powershell"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2671"}],"version-history":[{"count":6,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2671\/revisions"}],"predecessor-version":[{"id":2688,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2671\/revisions\/2688"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}