Working with Recovery Storage Group in Exchange 2007 using powershell and Microsoft Exchange Troubleshooting Assiatance

 

Recovery Storage group is the feature of restoring and mount the second copy of the exchange mailbox store to the exchange server to export mails and data from the required mailboxes with out affecting the production. This is originally introduced in Exchange 2003 SP1.

 

Features

  1. Only one Recovery storage group can be created in a exchange server
  2. Recovering database and Exchange 2007 server should be on the same active directory forest.
  3. Recovery Storage group can be managed in two ways one with Microsoft Exchange troubleshooting assistant(ExTRA) and Exchange power shell    

Below article describes procedure steps to work on Recovery Storage group using power shell

1. Below snap of DB3 which we will be working on recovering in to the Recovery Storage Group

 

 

 

2. Lets take the backup of DB3 using default windows Backup Utility

 

 

 

 

3. Create a new Recovery Storage group using Exchange powershell, below is the command for the same. –Recovery option will create a recovery storage group.

New-StorageGroup –Server <servername>  –LogFolderPath “D:\Recovery Storage Group\log” –Name “Recovery Storage Group” –SystemFolderPath “D:\Recovery Storage Group\log” –Recovery

 

4. Get-StorageGroup “Recovery storage group” | fl
   Will get the details of the new Recovery storage group which is created now

5. Create the new Database with the name DB3 and provide the path of the Edb file. 
  

5. Create the new Database with the name DB3 and provide the path of the Edb file.
   New-MailboxDatabase –MailboxDatabaseToRecover “DB3” –StorageGroup “Servername\Recovery Storage Group” –EDBFilePath “D:\Recovery Storage Group\DB\DB3.edb”

6. Once Mailbox Database is created we need to restore from the backup before that the restore we need set AllowFilerestore to true with the below command
    Set-MailboxDatabase -Identity “<ServerName>\Recovery Storage Group\DB3” -AllowFileRestore $true

7. Use Backup Utility to restore the Database to the Recovery Storage group. By selecting the DB3 and click restore and make sure that “Last Restore Set” is checked

 

 

 

 

 

 

 

 

 

 

 

 

8. Mount the Restored database using below mentioned power shell command
   Mount-Database –Identity “<SERVERNAME>\Recovery Storage Group\DB3”

9. Final step is merging mails from the Recovery Storage group mails to production mailbox. This can be done either both from ExTRA (Exchange Trouble shooting assistance) and from Power shell. I feel that recovering mail using Extra is much easier then recovering through power shell. Power shell will not only merge on the production mailbox into the folder name Recovered but ExTRA will directly merge into the production mailbox.  

10. To open ExTRA, Open Exchange Management console and click on tools and on the right panel click on Database Recovery Management.

 

 

 

11. Click on “Select Task” on the left column on ExTRA and click on Database recovery Management and  In the next page enter the Mailbox Server name and DC and click on  Next to continue to get the below mentioned page and click on Merge or copy mailbox content

 

 

 

 

 

 

 

 

 

 

 

 

12. Click on “Gather merge information”

 

 

 

 

13. Select the required mailbox and click on “Perform merge action” to merge the recovered mailbox to the production mailbox. Recovered mail will directly reflect in the mailbox of the user

Converting Legacy Mailbox to User Mailbox in Exchange 2007

 

During migration of users from Exchagne 2003 to exchagne 2007  some time you may see like after user is migrated to exchange 2007 server and if you see the properties of the user , it will still show as Legacy mailbox.  If user is still showing as Legacy Mailbox then chances that OWA may not work for that user. User has to be converted to the regular mailbox. Below is the powershell to set legacy mailbox to user mailbox.

Set-Mailbox -id <Username> -ApplyMandatoryProperties

Adding Mail enabled public folder as the member of Distribution list

Some times you may wanted to add mail enabled public folder as the member of Distrubution list and you wanted to send copy of mail to PF which is sent to distrubution list.  For this you may need to add mail enabled public folder as the member of the DL

Its not possible add public folder as members of DL in Exchange 2003. This can be only done from Exchagne 2007.
Throught Exchange 2007 you can add both throught Exchange management console and Powershell command

Powershell command
Add-DistributionGroupMember  -Identity “DLName”  -Member “Email address”

Exchange Management console
Expand Recipient Configuration -> Distibution Group -> find the requied DL -> Add the same

Preventing Internal mails from application reaching Junk E-mail folder

Some times there can be chances that internal mail from the application reaches Junk Email folder and some reaches Inbox. Some time it annoys you because some reaches inbox and other to Junk Email folder.

Every mail will be checked for the SPAM CONFIDENTIAL LEVEL (SCL). If SCL is more than 5 then mail will directly reach Junk email folder.

We can modify the SCL of the mails with the help of transport rules

1. Create the Email account(address) with the required email address for the application
2. Open Exchange Management console
3. Expand Organization Configuration
4. Select Hub Transport
5. On the right side Click on New-Transport rule
6. Input the Name -> click Next
7. Check “From People” -> Bottom click on people and browse the from address
8. Click Next -> Check “Set the spam confidence level to value” and set the value to “-1”


9.      Click next to and new to create the new one

Removing Dead or Dirty Exchange 2003 Server from AD and ESM

Removing dead Exchagne 2003 servers from the Exchange System Manager and Active Directory please follow below mentioned steps

1. Open Exchange system Manager
2. Expand Adminstrative group until you reach the required server
3. Right click on the server -> All Tasks -> Remove Server
4. Confirm the same by clicking yes.

If this did not help then you may need to Dig into Active directory through Adsiedit and remove the server Manually

Go to Start, Run and write ADSIEdit.msc and hit OK button.

Configuration Container
CN=Configuration, DC=Domainname,DC=com
CN=Services
CN=Microsoft Exchange
CN=Your_Organization_Name
CN=Administrative Groups
CN=AdminstrativeGroup_Name
CN=Servers
Right click on the Required server click Delete  and confirm the same.

Powershell to get the list of Disconnected mailbox in the Exchange Server

If we delete a user account then it will automatically disconnects mailbox from the account and adds to Disconnected Mailbox list. Mailbox  will be listed until retention period of 30 days

Get-MailboxStatistics -server <servername> | where { $_.DisconnectDate -ne $null } | select DisplayName,MailboxGuid,Database,DisconnectDate

Gets the list of Disconnected mailbox in the specified Exchange 2007 Server

 

Get-MailboxStatistics  | where { $_.DisconnectDate -ne $null } | select DisplayName,MailboxGuid,Database,DisconnectDate

Gets the list of Disconnected mailbox on the Exchange 2007  maibox server where you are running this command

Deleted Mailbox not appearing in Disconnected mailbox in Exchange 2007

Deleted mailboxes will appear in disconnected mailbox list, but it will not reflect immediately. We have to wait for online maintenance to run and complete.

If we accidentally delete mailbox and if we wanted to reconnect it back then we may not be able to find it Disconnected Mailbox. We have run Clean-MailboxDatabase to get the deleted mailbox.

Eg.

Clean-MailboxDatabase \servername\SGName\Store
Cleaning Database of Individual Store

Get-Mailboxdatabase | Clean-MailboxDatabase
Cleans all the database in the Organization

Get-Mailboxdatabase | Where{ $_.Server –eq “<servername>”}| clean-MailboxDatabase
Cleans all the database in the specific store

Get-Mailboxdaatabase | Where{ $_.Name –eq “<DatabaseName>”}| clean-MailboxDatabase
Cleans all the Database which matches the specific name given in Databasename

Changing password of Exchange 2003 users throught Exchange 2007 OWA

Changing password of user can be done throught OWA.  If you are running Exchange 2007 environment on Windows 2007 with IIS 7.0 and also has Exchagne 2003 users then changing password throught Exchagne 2007 OWA would not be possbile you will get “404 page not found” Error message.

 As The Change Password feature in Exchange Server 2007 Outlook Web Access does not require the IISADMPWD functionality.  IISADMPWD functionality is used to change password in Exchange 2003 servers. 

Work around solution

1. When user is in inside office network then he/she can access OWA throught http://exchnage2003servername/exchagne/username

2.  a. Create the appropriate IISADMPWD folder and virtual directory on each Client Access server
b. Change the registory in Exchange 2003 backend serves – Click Start -> Run -> type regedit -> ok
c. Expand to the this path HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSExchangeWeb\OWA
d. Right click and create new DWORD with the name Disablepassword and set value to 0
e. On each Client access server, open IIS Manager, and then select Web Service Extensions.
f. In the result pane, select Active Server Pages, and then click Allow.

 

Reference Page : http://technet.microsoft.com/en-us/library/bb684904.aspx

Powershell to find the size of Spam Mails folders in the Exchange mailbox

Below script can be used to find the size of spam  Mails folder in the User mailbox for the given list of users. Export list of users from the server throught below command and input into the Name.txt and Execute 

Get-mailbox | Where{$_.Servername -eq “Servername”} | select-object Alias > c:\Names.txt

 
$UserList = Get-Content “C:\Names.txt”
foreach($user in $UserList)
{
     $Spamsize = get-mailboxfolderstatistics $user | Where {$_.Name -match “Spam”}  | select  FolderAndSubfolderSize
     $output = $user + ” ” + $spamsize.FolderAndSubfolderSize/1mb
     Write-output $output 
}

Activeroles Quest Management Powershell to check User account Active or Disabled

You can download Active roles Quest Management shell from the below mentioned link.

http://www.quest.com/powershell/activeroles-server.aspx

Commands to check if mailbox is active or disabled

Get-QADUser <username> -enabled              

Will get the result if acount in active

Get-QADUser <username> -disabled                

Will get result if account is disabled

Get-QADUser  -Enabled       

Will get  all the enabled in the Active Directory

Get-QADUser  -Disabled      

Will get all the disabled users in the Active Directory

get-content “C:\users.txt” | Get-QADUser -enabled | select Email 

Will get list of all active users email address from the given input users