Category Archives: PowerShell

Restore Exchange 2007 Databases from Tape to new Mailbox Server

We had 6TB of email databases go offline from a double disk RAID5 failure.

Built new Exchange 2007 Mailbox Server on 2008 R2 as we took this opportunity to get the failed mailbox server off 2003 server.

Restored edb and log files from tape to new mailbox server MBX4.
D:\DB1\Mailbox Database.edb
D:\DB1\Logs

Replay Logs using eseutil using the following command
Go to D:\DB1\Logs directory
E02 is the checkpoint file, this is different, look at the first 3 of the logs prefix to determine this
eseutil.exe /R E02 /I /DD:\DB1\ /SD:\
This process can take 5-60 minutes depending on how many log files there are.

eseutil

Once this completes create a new storage group and point it to the Database Folder, and the Database Logs folder. This will take a bit to create, so be patient.

StorageGroup-2

Rename database edb file
Rename Mailbox Database.edb to Mailbox Database.edb.oldCreate a new Database in the storage group you just created called Mailbox Database.edb, DO NOT mount the database.
Rename the Mailbox Database.edb.old back to original, remove .old

Go into the database properties and adjust the quota’s and make sure you check ‘This database can be overwritten by a restore’

DBProperties

Mount the Database

Run the following powershell command to re-home the mailboxes from the old mailbox server to the new mailbox server

[PS] C:\Windows\system32>Get-Mailbox -Database “MBX1\Storage Group
\Mailbox Database” | where {$_.ObjectClass -NotMatch ‘(SystemAttendantMailbox|ExO
leDbSystemMailbox)’}| Move-Mailbox -ConfigurationOnly -TargetDatabase “EXMBX4\Storage Group\Mailbox Database”

Run the following command to show all the mailboxes in the database and export to a txt file so you know who’s mailbox is back online

[PS] C:\Windows\system32>Get-Mailbox -Database “Storage Group\Mailbox Data
base” > C:\DB1.txt

Scan to Email goes to Outlook Junk Filter

When scanning documents through a copier to email, the created emails with the PDF attachments are going to built-in Junk Folder.  On the Exchange server I ran the following command in the Exchange powershell Get-OrganizationConfig and look for SCLJunkThreshold  this should be set to higher the SCL value the scanned email is coming in as.

get-organizationconfig

 

The email’s in the Junk Folder had an SCL value of 5, so I ran the following command to change the SCLJunkThreshold.

Set-OrganizationConfig -SCLJunkThreshold 6

Run another Get-OrganizationConfig and confirm the changes took effect.

HowTo View Exchange Services Health

Last weekend I installed SP2 and UR3 onto our Exchange 2010 CAS and Hub Transport servers, along with the mailbox server.  Mail flow seemed fine afterwards and I was able to send and receive emails, but sometime over the weekend two services stopped.  I started the services Monday morning before everyone got it, but some automated reports ended up not running over the weekend.

Solution 1: I put a powershell script in place that I found online that monitors the Exchange Servers and emails me daily at 8PM through a scheduled task.  I will eventually be modifying it to show the hard drive space of all the partitions.
http://exchangeserverpro.com/powershell-script-health-check-report-exchange-2010

Solution 2:  There is a command you can run in the Exchange Management Shell that will show you the status of all the Exchange Services on each server, and show which are running, and which are not.  This command is Test-ServicesHealth.