Microsoft Exchange Server 2016 PowerShell Cookbook - Fourth Edition
by Jonas Andersson, Nuno Mota, Mike Pfeiffer
How it works...
In this example, we started with using New-ComplianceSearch to create a Compliance Search to find the emails we want to remove from the testuser's mailbox. We used the -ExchangeLocation to specify a single mailbox, but we could have used All to search all mailboxes in the organization. Similar to the SearchQuery parameter in Search-Mailbox, we can be more specific in our search using ContentMatchQuery and specify a From or Received search parameters for example. In this example, we are only searching for e-mails with the subject New HR Form no matter who the sender is.
Next, we start our search using the Start-ComplianceSearch cmdlet since this does not happen when we run New-ComplianceSearch. Once the search is complete, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access