Scripting: Exchange 2007 — Exporting Mailboxes to Personal Folders FilesA new feature in Exchange 2007 Service Pack 1 is the ability to export a mailbox to a personal folders file (.PST) using a command line in the Exchange Management Shell. However, it requires a 32-bit workstation and Microsoft Outlook 2003/2007, whereas it is most normal to run Microsoft Exchange 2007 on a 64-bit operating system, without a local copy of Outlook. This is the procedure to configure a workstation to run automated mailbox backups to PST. - Install the 32-bit Microsoft Exchange Server 2007 Management Tools on the workstation. Download the edition (SP1, SP2, SP3 etc ) that matches the Exchange Server 2007 service pack level.
The installer will prompt for the various dependencies, such as Powershell 2.0 (however PowerShell 4.0 is recommended), Windows Installer 4.5, .NET Framework, and IIS components. Choose Custom Exchange Server Installation. Choose the “Management Tools” option when prompted during the setup: - Apply the most recent rollup for the selected version of Exchange Server. For example, Update Rollup 16 for Exchange Server 2007 SP3.
- Use Windows Update to check for further Exchange Server updates, install them and let the machine reboot.
If the updates do not request a reboot, log out. Remain logged-out for the moment. - On the Exchange Server server, open the Exchange Management Console, click on Organization Configuration, and choose Add Exchange Administrator:
Add the user doing the exporting to the Exchange Server Administrator role. (This process will prompt that the user also needs to be a domain administrator, but this is not required for this purpose.) - On the Exchange Server server, give the user doing the exporting full access to the mailboxes being exported. Open the Exchange Management Shell and run the following command:
Add-MailboxPermission -Identity <AliasOfUserBeingExported> -User <AliasOfUserDoingExporting> -AccessRights FullAccess To determine the user aliases, use the command: Get-Mailbox To assign the permissions to all accounts, issue the command: Get-Mailbox | Add-MailboxPermission -User <AliasOfUserDoingExporting> -AccessRights FullAccess - On the workstation, create a text file containing the export commands:
Get-Mailbox | Export-Mailbox -PSTFolderPath C:\PSTFiles -Confirm:$false Save as, say, C:\PSTFiles\ExportPST.ps1. To export a single mailbox, use the command: Export-Mailbox -Identity <Mailbox> -PSTFolderPath C:\PSTFiles -Confirm:$false - Create a text file which will be the command-line script to run the Exchange commands:
del C:\PSTFiles\*.pst PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.Psc1" -Command ". 'C:\PSTFiles\ExportPST.ps1'" Save as, say, C:\PSTFiles\ExportPST.bat. - C:\PSTFiles\ExportPST.bat may now be scheduled to run using Task Scheduler.
“Run with highest privileges” must be enabled (so the process can write to the log files under C:\Program Files) and it must run under the user account above.
The logs for this operation are stored in C:\Program Files\Microsoft\Exchange Server\Logging\MigrationLogs. Powershell 0xc0000005 ErrorPowershell.exe may crash with a 0xc0000005 error in mspst32.dll or olmapi32.dll. This may occur when Export-Mailbox attempts to write to an existing .PST file which is damaged or empty or has some other problem. Although the Confirm:$false command should cause the script to overwrite existing files, the Export-Mailbox applet appears to enumerate/read any existing files first. Thus it is preferable to delete any existing .PST files in the target folder (as above) before running the applet. Incomplete Export/-2147221219 ErrorIf the exported PST files seem too small, or if not all mailboxes are exported, this may be because Exchange 2007 on the server is not the same service pack level as that on the workstation. Ensure they are the same, and it would be preferable if they are both running at the last service pack & post-service pack hotfix level. Additionally, the following may appear in the logs: Error occurred in the step: Approving object. An unknown error has occurred., error code: -2147221219. Error -2147221233This has been observed on systems running Outlook 2013. It may also occur on systems with Outlook 2010 with KB2687623. UninstallingWhen uninstalling an instance of Exchange 2007 which only has the Management Tools installed, the Uninstall option via Programs and Features in the Control Panel will prompt: “Please specify an existing server role(s) to uninstall”, despite the fact there are no server roles installed, and the process cannot continue. To uninstall Exchange in this situation requires using the command-line interface. Open an elevated command prompt and type: cd /d "%ProgramFiles%\Microsoft\Exchange Server\Bin" Setup.com /mode:Uninstall /roles:MT
Copyright © 1996-2023 Cadzow TECH Pty. Ltd. All rights reserved. Information and prices contained in this website may change without notice. Terms of use. Question/comment about this page? Please email webguru@cadzow.com.au |