Exporting mailboxes is great but what if you only wanted information for a certain period as you need it for whatever reason, legal, manager, etc.

Well using the Exchange Management Shell (EMS) you can run the following command to export the data:

  • $Users = Get-Content “C:\Users\User1\Desktop\doc.csv”
  • foreach ($User in ($Users)) {New-MailboxExportRequest -Mailbox $User -ContentFilter {(Received -gt ’01/31/2018′) -and (Received -lt ’07/02/2018′) -AND (Sent -gt ’01/31/2018′) -AND (Sent -lt ’07/02/2018′)} -Filepath “\\Server01\PSTExport\USer1\$($user).pst” }

The above command is first getting its content from a CSV file saved to a location of choice.

The second part of the command loops through each User in the CSV for the given date and then exports it to a .PST file at the location you specified.

Hope it helps.

    wpChatIcon

    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading