New mailboxexportrequest examples
Here are some examples of MailboxExportRequest
objects in PowerShell:
Example 1: Export all mailboxes in the organization
$mailboxExportRequest = New-MailboxExportRequest -Mailbox -IncludeFolders \* -FilePath \\server\share\export.pst
This example exports all mailboxes in the organization to a PST file located at \\server\share\export.pst
.
Example 2: Export a specific mailbox
$mailboxExportRequest = New-MailboxExportRequest -Mailbox "john.doe" -IncludeFolders \* -FilePath \\server\share\john.doe.pst
This example exports the mailbox of the user "john.doe" to a PST file located at \\server\share\john.doe.pst
.
Example 3: Export a specific mailbox with a specific folder
$mailboxExportRequest = New-MailboxExportRequest -Mailbox "john.doe" -IncludeFolders "Inbox\Subfolder" -FilePath \\server\share\john.doe.pst
This example exports the "Inbox\Subfolder" folder from the mailbox of the user "john.doe" to a PST file located at \\server\share\john.doe.pst
.
Example 4: Export all mailboxes in a specific database
$mailboxExportRequest = New-MailboxExportRequest -Database "DB01" -IncludeFolders \* -FilePath \\server\share\db01.pst
This example exports all mailboxes in the database "DB01" to a PST file located at \\server\share\db01.pst
.
Example 5: Export all mailboxes in a specific organization unit
$mailboxExportRequest = New-MailboxExportRequest -OrganizationalUnit "OU=Finance,DC=example,DC=com" -IncludeFolders \* -FilePath \\server\share\finance.pst
This example exports all mailboxes in the organization unit "OU=Finance,DC=example,DC=com" to a PST file located at \\server\share\finance.pst
.
Note: You can also use the -WhatIf
parameter to simulate the export request without actually exporting the mailboxes. For example:
$mailboxExportRequest = New-MailboxExportRequest -Mailbox "john.doe" -IncludeFolders \* -FilePath \\server\share\john.doe.pst -WhatIf
This will show you what mailboxes would be exported and where they would be exported to, without actually exporting them.