Problem:
Wanting to have a backup of user PSTS so I can import should other methods prove extraneous.I've done windows backup, file level and NOT a disc image, due to UEFI and not being experienced enough to feel comfortable with that in production.
I want to export all users to a pst file for peace of mind, sanity and an alternative option that will be easier -- IE importing mailboxes into a new domain w/o giving a crap about preserving any of the old domain data.
Really, I want to avoid having to crap my pants when I realize that the last mailbox database name was done with a capital letter, typo, or the settings I'm trying to escape royally boned me.
This guide will walk you through , ultimately setting a script in motion to export all users from a database without any further intervention.
1. Set up the share to receive psts
Set up the shared folder,create a folder to be shared (I choose pst due to not having spaces in the path) and give "exchange trusted subsystem" both full security AND share priviledges -- I remove users, and add administrators and specifically the account i want to backup with.
make sure you can access the share
2. Discovering your Mailbox Database name:
I was having difficulties getting pointed to my mailbox. The name, according to other powershell guides I was following was to fqdn followed by "Mailbox Database" for the name, I couldn't get it to work with the server, it just wanted the domain - even then I had to bypass using guidnone of the commands would take what i thought it would be, or variations, so I found how to get the GUID which was accepted w/o fqdn suspect database names
get-mailboxdatabase -storagegroup "First Storage Group" | fl
Basically, when the script called for a database name, I used the guid.
I think it's not a fqdn and rather just a dn- fqdn means server included, so server.domain.local wasn't getting me there but domain.local would have. So I think it may have been just 'domain.extension\Mailbox Database'
3. Giving Permissions
Give the account you intend to run the backup from the correct priviledges by running this commandChange "-user administrator" to the username you intend to run the backups from
New-ManagementRoleAssignment –Role "Mailbox Import Export" –User Administrator
4. Run the script and wait
Open notepad and paste the following:$mailboxes = get-mailbox
foreach ($mailbox in $mailboxes) {
new-mailboxexportrequest -mailbox $mailbox -FilePath \\server\pst\$mailbox.pst
}
Save the notepad file as a .ps1 - a powershell script.
Open the exchange console (powershell) and drag the script we just created in. It should appear w/o quotes around it and simply run.
You can check the status of the transfer by typing
get-mailboxexportrequest
5. Importing:
After you've made your move, recreated the accounts, repeat steps 1-3then run this powershell script
$mailboxes = get-mailbox
foreach ($mailbox in $mailboxes) {
new-mailboximportrequest -mailbox $mailbox -FilePath "\\server\shared\$mailbox.pst"
}
Done!
Further Jobs:
Find out reason for failure
Get-MailboxExportRequest -status failed | Get-MailboxExportRequestStatistics -IncludeReport | Format-List > \\$server\$share\filename.txt
Making powershell able to run scripts
Allow scripts: Set-executionpolicy unrestricted
Disable Scripts: Set-executionpolicy restricted
Note, if you have any difficulty with the scripts, keep in mind they're not cut and paste - you're going to have to change the path to match your environment (IE "server" should be your servername, "shared", the folder you've shared.)
Sources, cites & credit due:
Setting up permissions, shares: http://exchangeserverpro.com/export-mailboxes-exchange-server-2010-sp1The Script to automate the exporting of users: http://www.cohesivelogic.com/2011/06/export-all-mailboxes-to-pst-in-exchange-2010-sp1/
No comments:
Post a Comment