TechShizz | All posts tagged 'Exchange 2010'

Recover a Mailbox from a Mailbox Database restore

If a mailbox is corrupt or for some reason you need to revert a mailbox back to a backup, you'll need to restore the data and then mount the exchange mailbox database to recover the items.

Steps to complete:

1. Check if database is in clean or dirty shutdown.
eseutil /mh "e:\recovered\database\Mailbox Database 2012103015.edb"

2. If dirty, run a soft clean then repeate step 1 to veryfy results.
Eseutil /R E00 /l E:\recovered\logs /d E:\recovered\database\

3. Put datapase and logs in respective folders E:\recovered\  (logs) and (database) then create a recovery database from the restore.
New-MailboxDatabase -Recovery -Name recovery3 -Server ALPHA -EdbFilePath "E:\Recovered\Database\Mailbox Database 2012103015.edb" -LogFolderPath E:\Recovered\logs\

4. Restart the Microsoft Excahnge Information Store

5. Mount the Database

6. Check it's contents exist.
Get-MailboxStatistics -Database Recovery3 | ft -auto

7. Create a mailbox to restore to

8.Run the restore request.
New-MaiboxRestoreRequest -SourceDatabase recovery3 -SourceStoreMailbox "Graeme Jones" -TargetMailbox "recovery3@domain.local" -AllowLegacyDNMismatch

Get all X500 addresses in a domain using PowerShell

Run this command in PowerShell with the Active Directory module loaded.

Import-Module ActiveDirectory

Get-ADUser -SearchBase “OU=SBSUsers,OU=Users,OU=MyBusiness,DC=MyDomain,DC=local” -Filter * -Properties SamAccountName,legacyExchangeDN | Select-Object SamAccountName,legacyExchangeDN | Export-CSV C:\UserExport.csv -NoTypeInformation

How to Find and Set Calendar Permissions with Power Shell

To give the boss permissin to edit Rich's calendar run:

Add-MailboxFolderPermission -Identity rich@techshizz.com:\Calendar -User boss@techshizz.com -AccessRights Editor

To check if this worked:

Get-MailboxFolderPermission -Identity rich@techshizz.com:\Calendar

Useful Techdata for all Parameters | https://technet.microsoft.com/en-us/library/ff522363%28v=exchg.160%29.aspx

Repair Exchange database after dirty shutdown

1. Backup the edb, logs, and stm files

Copy the priv.edb, pub.edb, logs and stm files to an other place.(backup to disk)

 

2. Make sure you have 110% Free Disk Space

Make sure you have 110% free diskspace from your database. Don´t use shares. you have to fix the priv.edb and pub.edb with the following steps:

 

3. Check your DB consistency

Make a consistency check on your db.

[ eseutil /mh „path of the priv.edb"] (eseutil /mh “c:\db\mailbox database.edb”)

 

4. Check the status,

it will be: dirty shutdown.

 

5. Try Softrepair

try softrepair:

[eseutil /r] – run it from database log folder and specify log chk file (c:\dblog>eseutil /r E00).

or specify following [eseutil /r "prefix"<E00> /l <log file location> /d <database location>]

Eseutil /r E00 /l c:\dblog /d c:\db

 

6. Check Consistency Again

after softrepair check consistency again.

if everything clear shutdown --> ok (go to step 9)

 

7. If Softrepair doens't work try hard repair (runs at about 3-5 Gig of data per hour)

if softrepair doesn´t work for you try hardrepair:

[eseutil /p], (Eseutil /p “mailbox database.edb”), Eseutil /p "c:\program files\exchsrvr\mdbdata\priv1.edb"

 

8. Defragment the DB (runs at about 3 to 5 Gig per hour)

defragmentation of db:

[eseutil /d] (Eseutil /d “mailbox database.edb”)

After running /d you must remove any log files in the MDBDATA folder before mounting the database.

 

9. Check DB Integrity

If we do not have time (runs at about 2 to 10 minutes per Gig of data) we can skip it after softrecovery.

check the integer of db:

[isinteg -s "servername" -test alltests]

if integer check fails, try [isinteg -s "servername" -fix -test -alltests] do this until all errors have level 0 or the status has no changes. (sometimes it takes 3 rounds to fix all errors )

 

10. Check Consistency Again

consistency check again.

[eseutil /mh] the result should be: clear shutdown.

 

Action Plan for running a Hard repair of the databases:

PN: Ramifications of running the eseutil /p or edbutil /d /r command http://support.microsoft.com/kb/259851

 

1. Make sure the databases are dismounted in ESM.

2. Before running the Hard Repair, I would suggest you to make a copy of the priv1.edb , priv1.stm and pub1.edb , pub1.stm

Now From a command prompt, run eseutil in the repair mode syntax should be:

Eseutil /p "c:\program files\exchsrvr\mdbdata\priv1.edb"

 

-Using ESEUTIL /p is a last resort utility that is only run when databases will not mount due to inconsistancy.

-ESEUTIL /p deletes any data needed (corrupt data or incomplete transactions) to bring the database to a consistent state.

-ESEUTIL /p runs at about 3-5 Gig of data per hour.

-NOTE: Do not click in the command prompt screen, it causes the ESEUTIL process to PAUSE, if this occurs you can press the F5 key to resume.

 

3. Once that completes, run the same command against the pub1.edb file.

4. Run an offline defrag of both databases. The syntax should be:

Eseutil /d "c:\program files\exchsrvr\mdbdata\priv1.edb"

 

-You must have at least 110% free space, relative to the database size to run ESEUTIL /D.

-If you do not designate a temp location using the t command, it defaults to the directory EXCHSRVR/BIN

-ESEUTIL /d runs at about 3 to 5 Gig per hour

-After running /d you must remove any log files in the MDBDATA folder before mounting the database.

 

How to Defragment with the Eseutil Utility (Eseutil.exe) http://support.microsoft.com/?id=192185

5. Once that completes, run the same command against the pub1.edb file.

6. Disable the SMTP service prior to mounting the databases to prevent new email from coming in to the databases.

Mount the databases with the repaired/defraged database.

Logon to make sure you can access one of the mailboxes, but will want to then immediately dismount both of the stores

7. You will then need to run an isinteg to fix any corruption at the store level.

The syntax should be:

Isinteg -s servername -fix -test alltests

 

- ISINTEG Must be run after ESEUTIL /P or ESEUTIL /d to remove logical corruption caused by deletions

- ISINTEG -FIX runs at about 2 to 10 minutes per Gig of data

- Select the database to run the utility against. (The database must be dismounted)

- ISINTEG will create a log file named ISINTEG.PRI in the MDBDATA folder (open with Notepad)

- Note the number of FIXES we get after each run of ISINTEG -FIX. We will need to run this till we get 0 fixes.

- This may take 3 or more times.

- Also note the number of errors we get after each run of ISINTEG -FIX

- Once we get 0 FIXES note the number of errors.

Description of the Isinteg Utility http://support.microsoft.com/?id=182081

Set Message Size Limits in Exchange 2010 and Exchange 2007

Typical Errors:

#550 5.2.3 RESOLVER.RST.SendSizeLimit; message too large for this sender ##

#550 5.2.3 RESOLVER.RST.RecipSizeLimit; message too large for this recipient ##

There are several places to check/set message size limits:

1. Organizational Limits
Set-TransportConfig -MaxReceiveSize 40MB -MaxSendSize 40MB

In Exchange 2007 SP1 and later, you can also set the organizational message size limits using the EMC by going to Organization Configuration | Hub Transport | Global Settings tab | Transport Settings | properties | General tab.
Transport Settings Properties
2 Receive Connector Limits
Set-ReceiveConnector “CONNECTOR NAME” -MaxMessageSize 40Mb
.
To modify the maximum message size on a Receive Connector using the Exchange console, select Server Configuration | Hub Transport | select a Hub Transport server | Receive Connectors -> select a connector | Properties | General tab.
Receive Connctor Properties
3. Send Connector Limits
Set-SendConnector “CONNECTOR NAME” -MaxMessageSize 40Mb

To modify the maximum message size on Send Connectors, select Organization Configuration | Hub Transport | Send Connectors -> select connector | Properties | General tab.
Send Connector Properties
4. Recipient Limits
Set-Mailbox “Rich” -MaxSendSize 20Mb -MaxReceiveSize 20Mb

To set these using the Exchange console: Recipients | Mailbox -> select mailbox (or select another recipient type such as a contact or mail user from the corresponding node) | properties | Mail Flow Settings tab | Message Size Restrictions.
To modify the maximum message size on Send Connectors, select Organization Configuration | Hub Transport | Send Connectors -> select connector | Properties | General tab.
Recipient Limits
5. Active Directory Site Link Limit
By default, the MaxMessageSize on AD Site Links is set to unlimited. This can be changed using the following command:

Set-ADSiteLink “DEFAULTIPSITELINK” -MaxMessageSize 20Mb

6. To track messages that failed because of recipient’s MaxReceiveSize:

Get-MessageTrackingLog -EventID FAIL | where {$_.RecipientStatus -like “*RecipSizeLimit*”}

To track messages that failed because of the sender’s MaxSendSize:

Get-MessageTrackingLog -EventID FAIL | where {$_.RecipientStatus -like “*SendSizeLimit*”}