Saturday, April 1, 2017

How to create Recovery database in Exchange 2016 (with Snapshot).

Hello Friends, Today I will show you how you can create a Recovery database in Exchange 2016. Recovery database can be very useful if you want to restore few emails of a user mailbox or want to restore the whole mailbox. Recovery database is a feature in Exchange 2016 which helps us to restore a mailbox from a back up copy of mailbox database. Recovery database allows us to merge the emails of a mailbox from a back up copy of a mailbox database with a mailbox which is currently residing on a mounted copy of mailbox database.

I have an user MSFT , The user had an  important email on his mailbox however the user accidentally deleted all the email on his mailbox now the user wants those emails back.

I have restored a copy of the mailbox database from my back up utility, The name of the mailbox database is mailbox database is "Mailbox Database 1978255080.edb".
I will use the restored mailbox database to restore the deleted emails for the MSFT mailbox.
Run the below command from Exchange Powershell to create a Recovery database.
New-MailboxDatabase -Recovery -Name <RDBName> -Server <ServerName> -EdbFilePath <RDBPathandFileName>

Once the Recovery database is created then restart the Microsoft Exchange Information store service. Run the below command from Exchange Powershell.
Restart-Service MSExchangeIS

We will have to mount the recovery database now however before mounting the Recovery database we will have to bring the Recovery  database in to clean shutdown so that the Recovery database can be mounted.
Run the below command to repair the Recovery database.
eseutil /p "C:\Recovery\Mailbox Database 1978255080.edb"
Note:- My database couldn't be repaired using soft recovery so I have used hard repair switch to repair the mailbox database. You can also use the soft recovery switch to repair the mailbox database.

Recovery database is in clean shutdown, We can check by running the below command.
eseutil /mh "C:\Recovery\Mailbox Database 1978255080.edb"

Run the below command to mount the Recovery database.
Mount-database <Recovery database>

Run the Below command to find out the mailboxes that resides in the Recovery database.
Get-MailboxStatistics -Database <Recovery database>

The mailbox that needs to be restored should show up. We can see that MSFT mailbox is in the Recovery database.
Run the below command to restore the mailbox with name "MSFT" from Recovery database to the user mailbox that has the email address

New-MaiboxRestoreRequest -SourceDatabase Rec_db -SourceStoreMailbox "MSFT" -TargetMailbox

Once the command is run, The Restore process will be initiated. We can see here the restore process is in Queued state. We can check the status of the restore process by running the below command.


Now the MSFT mailbox is restored. The accidentally deleted important email is back in the mailbox.

Run the below command to Remove the restore request, This can be achieved using Remove-MailboxRestoreRequest command.
Get-MailboxRestoreRequest -Status Completed | Remove-MailboxRestoreRequest

Note:- A mailbox restore can be done using different attributes, Below is another example to restore a mailbox using different attributes.

You can find out the mailbox GUID using the below command.
Get-MailboxStatistics -Database rec_db |fl DisplayName,*GUID*
and then use the below command to restore the mailbox that has the MailboxGUID 44b7f929-786f-4fd1-a001-db903279b9f3 on mailbox database Rec_db to the target mailbox with the alias MSFT.

New-MailboxRestoreRequest -SourceDatabase Rec_db -SourceStoreMailbox 44b7f929-786f-4fd1-a001-db903279b9f3 -TargetMailbox msft

Wednesday, March 8, 2017

How to Install Exchange 2016

Hello Friends Today i will show how you can install Exchange 2016 server.I have installed 2012 R2 server and a Domin controller. I have downloaded the ISO of Exchange 2016. I will run the below script from powershell as this will enable the  features which is a pre requisite for Exchange 2016 Mailbox Role.

Install-WindowsFeature NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation, RSAT-ADDS

If you also plan to install management tools then run the below command from Windows PowerShell.

Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools,IIS-ManagementScriptingTools,IIS-IIS6ManagementCompatibility,IIS-LegacySnapIn,IIS-ManagementConsole,IIS-Metabase,IIS-WebServerManagementTools,IIS-WebServerRole


It is recommended to reboot the server so that the changes can come in to effect.
Run the Exchange 2016 setup file as an Administrator, This will extract the Exchange set up.
Once the file is extracted, Navigate to the Extracted folder on Command prompt and run the below command to prepare the schema.

setup.exe /prepareschema /iacceptexchangeserverlicenseterms

Now we need to prepare the AD, Since this is the first Exchange server in the environment so we will have to give the Organization name. Chose the organization name as per your convenience, I am choosing the Organization name as "First Organization".
Run the below command from the command prompt.

setup.exe /prepareAd /Organizationname:"First Organization" /iacceptexchangeserverlicenseterms

Now we will start the install of the Mailbox Role and Management Tools.
To install Management tools you will require .NET Framework 4.5.2

Run the below command to Start the install.

setup.exe /m:install /r:Mailbox, mt /iacceptexchangeserverlicenseterms

The set up might fail if some of the patches are not installed or Feature is not enabled, I was asked to install Unified Communications Managed API 4.0 Runtime and enable the Media Foundation feature.
I installed the patch and enabled the Feature. Initiated the install again.

The installation completed successfully.







Sunday, February 26, 2017

How to Restore a User/Group using Adrestore (Adrestore.exe) tool.

Hello Friends , Today i will show you how you can use the Adrestore(Adrestore.exe) tool to restore a deleted user/Group etc. When you delete a user, The user is not completely deleted from Active directory however the user is put in to deleted object container and the deleted user remains in the deleted object container till it's Tomstone period. Recovering a user using Adrestore doesn't bring back all the attributes of the user however it bring back only a subset of the attributes.

The main points about Adrestore tool is as below.
1)The Adrestore tool can be used to recover a user/group.
2)Adrestore doesn't bring back all the attributes of the user.
3)After the recover, The user will be disabled so the user has to be enabled.
4)You will have to manually set a password to the user as the password attribute can't be recovered.

Every user has a "IsDeleted" attribute, When a user is deleted then the "IsDeleted" attribute is set to"True" Which implies that the user is deleted.
I have created a user "netadmin", I have added the below Group membership to the user as the user is an Admin user.

1)Domain Admins.
2)Enterprise Admins.
3)Schema Admins.
4)Domain Users.

Now i accidentally deleted the user netadmin, I will recover the user using Adrestore.
Adrestore is a Microsoft tool which can be downloaded from the below link.
Download the Adrestore tool and save it on a folder.
Open command prompt and go the location where Adrestore resides.
We will be using -r switch to restore the deleted user.
Type Adrestore.exe -r and hit enter.

Once you hit enter , The Adrestore will show all the deleted users/Group one by one and will ask your permission if you want to restore the user/group.

If you know the name of the deleted user and you don't want the Adrestore tool to check all the deleted user then you can also use the command  "Adrestore.exe -r Username" to restore the user.

Once the user is restored then it will show up in Active Directory user and Computers console however the user will be disabled.

We will have to enable the user and then reset the password to use the user account again.
Now the user is recovered however most of it's Attributes are stripped off.

Before the netadmin user was member of Domain admins, Schema Admin, Enterprise Admins and Domain users group however after the restore the user is only a member of Domain users so all the other attributes of the user has to be added manually.