First of all you have to establish a PowerShell Session with your exchange server.
PS > $UserCredential = Get-Credential PS > $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://mail.mymailserver.at/PowerShell/ -Authentication Kerberos -Credential $UserCredential PS > Import-PSSession $Session -DisableNameChecking
Now you can access your Exchange Server with the Exchange PowerShell Module. Get-Mailbox for example will give you a list of all available mailboxes.
PS > Get-Mailbox
PS > Get-Mailbox | Search-Mailbox -SearchQuery "from: firstname.lastname@example.org" -TargetMailbox "raimund" -TargetFolder "searchresults"
A copy of all filtered emails is now inside a folder named searchresults in the specified raimund mailbox.
The Compliance Search feature in Exchange Server allows you to search all mailboxes in your organization. Unlike In-Place eDiscovery where you can search up to 10,000 mailboxes, there are no limits for the number of target mailboxes in a single search.
This is a really nice feature especially if you want to predefine search queries and then just execute them and if you dont want to copy the search results to a folder each time.
PS > New-ComplianceSearch -Name "Search All-Financial Report" -ExchangeLocation all -ContentMatchQuery 'sent>=01/01/2015 AND sent<=06/30/2015 AND subject:"financial report"' PS > Start-ComplianceSearch -Identity "Search All-Financial Report"