Good Afternoon!
I have a PowerShell command that I am trying to run to gather up some emails from our organization to a specific email domain. The script is:
Powershell
Search-Mailbox–Identityuser@domain.com-SearchQuery“To:@another.domain.gov" -TargetMailbox admin@domain.com -TargetFolder _Folder
This does the job of returning any email sent from user@domain.com to another.domain.gov. It also adds a folder in the target mailbox with all the returned addresses.
The issue... I need the -Identity to be *@domain.com... I need to search through ALL of our email records, find any email sent from any user to @another.domain.com from the past 5 years.
I've been going round and round with Microsoft on the correct command to use, but it's been an hour and a half and I'm hoping there is a PowerShell guru out there that can possibly provide...