{"id":1416,"date":"2016-04-01T17:26:30","date_gmt":"2016-04-02T00:26:30","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=1416"},"modified":"2017-06-21T15:38:05","modified_gmt":"2017-06-21T22:38:05","slug":"exchange-search-mailbox","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=1416","title":{"rendered":"Exchange Search Mailbox"},"content":{"rendered":"<p>In order to search a mailbox, the account you are using must be a member of the &#8220;Discovery Management&#8221; role group.  <\/p>\n<p>To check:<br \/>\n[PS] >Get-RoleGroupMember \u00e2\u20ac\u0153Discovery Management\u00e2\u20ac\u009d<\/p>\n<p>To add somebody to a role:<br \/>\nWhen you add somebody as follows, you will prompted for the member.  For example, Administrator.<br \/>\n[PS] >Add-RoleGroupMember \u00e2\u20ac\u0153Discovery Management\u00e2\u20ac\u009d<\/p>\n<p>If you are doing this as Administrator and are adding the Administrator account, you will need to restart your EMS (Exchange Management Shell).<\/p>\n<p>Once you have added the role, you will be able to use the Search-Mailbox cmdlet.  There are many search options.  Below is a simple example searching the subject of a mailbox.  The way this works is that the search results are sent to a target mailbox and folder.  <\/p>\n<p>[PS] C:\\> Get-Mailbox <em>alias<\/em> | Search-Mailbox -SearchQuery {Subject:&#8221;<em>searchfor<\/em>&#8220;}  -TargetMailbox <em>mailbox<\/em> -TargetFolder &#8220;<em>foldername<\/em>&#8221;<\/p>\n<p>Example:<br \/>\n[PS] C:\\> Get-Mailbox <em>jim<\/em> | Search-Mailbox -SearchQuery {Subject:&#8221;<em>work rules<\/em>&#8220;}  -TargetMailbox <em>mailadmin<\/em> -TargetFolder &#8220;<em>SearchJim<\/em>&#8221;<\/p>\n<p>So, in this example, the mailbox jim will be searched for any message with &#8220;work rules&#8221; in the subject line.  Any results, will be put in the mailadmin&#8217;s mailbox in a folder called SearchJim.<\/p>\n<p>You can do the same thing for the body of the message:<br \/>\n-SearchQuery {Body:&#8221;somethinginthbody&#8221;} <\/p>\n<p>Or a date range, except you have to specify sent or received:<br \/>\n-SearchQuery {Received:(1\/1\/2010..12\/31\/2010)}<br \/>\n-SearchQuery {Sent:(1\/1\/2010..12\/31\/2010)}<\/p>\n<p>Or if you want to search for more than one criteria:<br \/>\n[PS] C:\\> Get-Mailbox <em>alias<\/em> | Search-Mailbox -SearchQuery {Subject:&#8221;<em>searchfor<\/em>&#8221; AND Body:&#8221;<em>searchsomethingelse<\/em>&#8221; AND Sent:(<em>01\/01\/2010..12\/31\/2010<\/em>)}  -TargetMailbox <em>mailbox<\/em> -TargetFolder &#8220;<em>foldername<\/em>&#8221;<\/p>\n<p>To search To or From with a date with an estimate instead of copy to TargetMailbox:<br \/>\nSearch-Mailbox <em>alias<\/em> -SearchQuery {Sent:(01\/01\/2015..12\/31\/2015) AND To:user1@domain1.com AND From:user2@domain2.com} -EstimateResultOnly<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to search a mailbox, the account you are using must be a member of the &#8220;Discovery Management&#8221; role group. To check: [PS] >Get-RoleGroupMember \u00e2\u20ac\u0153Discovery Management\u00e2\u20ac\u009d To add somebody to a role: When you add somebody as follows, you will prompted for the member. For example, Administrator. [PS] >Add-RoleGroupMember \u00e2\u20ac\u0153Discovery Management\u00e2\u20ac\u009d If you are [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[125,398,247],"class_list":["post-1416","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-exchange","tag-mailbox","tag-search"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1416"}],"version-history":[{"count":7,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1416\/revisions"}],"predecessor-version":[{"id":1556,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1416\/revisions\/1556"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}