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 msft@shubh.com.

New-MaiboxRestoreRequest -SourceDatabase Rec_db -SourceStoreMailbox "MSFT" -TargetMailbox msft@shubh.com




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.

Get-MailboxRestoreRequest




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.






Sunday, October 23, 2016



Hello Friends, In this post i will discuss how you can retrieve deleted users from Active directory. When you delete an object(user/ OU) from Active directory , The IsDeleted attribute of that object is set to true and that object is moved to deleted object container.
The Distinguished name of the deleted object is changed. Every object in AD has a unique Distinguished name or DN which shows the location of that object in AD so when the object is deleted from AD then it’s DN is changed since it’s deleted from the current container and is put to Deleted object container hence a deleted object’s DN always points to Deleted object container. A deleted object will be kept in Deleted object container for the tombstone time period of that object, By default object in AD has a tombstone period of 180 days however you can change the default tombstone time period  to any custom value and this can achieved from adsiedit.msc. After the tombstone period the object will be deleted from AD in case AD recycle bin is not enabled. If the AD recycle bin is enabled then the deleted object will be moved from deleted object container to AD recycle bin. To summarize this i will give an example, let’s assume i have a user netadmin and the user is accidentally deleted from AD. Now the user will be moved to deleted object container  and will be kept in AD for it’s tombstone time period. The user will be deleted from AD after it’s tombstone period  in case if AD recycle bin is not enabled.
We can recover deleted user using ldp.exe tool. The first question that comes in mind is, what is ldp.exe ?
The answer of the above question in simple words will be ” ldp.exe is an utility to view,Search , Modify some of the objects of AD which can’t be viewed using the Administrative tools such as Active Directory users and Computers”.
Follow the below steps to recover a deleted user netadmin from Active Directory.
I had a user Netadmin in the Users OU , I have deleted the user accidentally.


Go to run and type ldp.exe,  You will be able to see the ldp.exe console which is totally blank. Go to connections tab on the top left hand corner of the window and click on connect. This will open up a window like this.





We will connect it to localhost and it does LDAP queries to fetch the information hence by default it will use port 389. Now After connecting it to a server , We need to bind it using an Authenticated credential. Click on Connections tab again and go to Bind, This will give you the below window. You can check the check box “Bind as currently logged on user” else you can explicitly give the Administrator’s credential and then hit ok.







Now once you hit ok, The LDAP query will use the credential given by you and will look like the below snapshot.


Click on the options tab and then go to controls sub menu, This will open a window








On the Load predefined drop down menu select return deleted objects and hit ok.
Now click on the View tab on ldp.exe window and go to tree sub menu which will open a new window and will ask you to select the tree view. On the drop down select DC=domain,DC=com and hit ok. I am attaching a snapshot of the same.

After selecting the tree view you will be able to see the deleted object container which contains the deleted netadmin user. Expand the Deleted Objects Container.














Expand the object which is deleted , here you see after expanding the netadmin, It says that Netadmin didn’t have any children object. Now right click on netadmin user and click on Modify, Which will open the below window.

In the Edit Entry Attribute menu type “Isdeleted” , Don’t type anything on the values menu and keep it blank. On the operation check box , Select delete and then hit Enter tab.In the Edit Entry Attribute menu type “DistinguishedName” and now on the values menu we need to enter the Distinguished Name of the deleted user(Previous DN before the deletion of the user). We can find this by looking at the Right hand side of the screen which shows the last Known parent of the deleted object , I have highlighted the same on the above screenshot. Now we need to type the DN of the deleted user hence add CN=username,and then the parent DN so the DN of the netadmin user will look like CN=netadmin,CN=Users,DC=shubh,DC=com , Remember don’t put any spaces in between the DN. On the Operation check box , Check replace and hit enter. Now the modify box should look like the below windows.










Click on the Run tab , The user will be recovered and you will be able to see the user under Active Directory users and Computers. Do let me know if you have any concerns recovering a user or understanding the whole concept.

Monday, September 26, 2016



Hello friends , On this Post i will discuss one of the error that you might come across while upgrading Exchange 2007 SP1  to it’s higher service pack or Roll up update. While upgrading you might get a pop up “Click ok to try again, or enter an alternate path to a folder containing the installation package ‘Exchangeserver.msi’ in the box below” . The pop up will ask you to redirect you the correct .msi file however even if you point the the file to the correct .msi file it wouldn’t take it. Eventually the only option is to cancel the upgrade. If you check the Exchangesetup.log you will get error like this.
[ERROR] Unable to remove product with code 24b2c164-de66-44fe-b468-a46d9d5e6b31. The installation source for this product is not available. Verify that the source exists and that you can access it. Error code is 1612.
Below is the snapshot of the pop up windows that we get during the upgrade.



If you check the Exchangesetup.msilog , You will get below error.

MSI (s) (C0:E0) [03:04:45:354]: Machine policy value ‘DisableUserInstalls’ is 0
MSI (s) (C0:E0) [03:04:45:354]: Note: 1: 2766 2: C:\Windows\Installer\13253.msi
MSI (s) (C0:E0) [03:04:45:354]: Warning: Local cached package ‘C:\Windows\Installer\13253.msi’ could not be opened as a storage file.
MSI (s) (C0:E0) [03:04:45:354]: User policy value ‘SearchOrder’ is ‘nmu’
MSI (s) (C0:E0) [03:04:45:354]: User policy value ‘DisableMedia’ is 0
MSI (s) (C0:E0) [03:04:45:354]: Machine policy value ‘AllowLockdownMedia’ is 0
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Media enabled only if package is safe.
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Looking for sourcelist for product {24B2C164-DE66-44FE-B468-A46D9D5E6B31}
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Adding {24B2C164-DE66-44FE-B468-A46D9D5E6B31}; to potential sourcelist list (pcode;disk;relpath).
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Now checking product {24B2C164-DE66-44FE-B468-A46D9D5E6B31}
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Media is enabled for product.
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Attempting to use LastUsedSource from source list.
MSI (s) (C0:E0) [03:04:45:354]: SOURCEMGMT: Processing net source list.

To resolve the issue Download Windows cleanup utility. Microsoft has removed the Windows cleanup utility from their website however you will be able to find the application on many website for free download. Install the Windows cleanup utility and run the Application.
Note:- Removing entries using Windows clean up utility can cause severe issues to the server so make sure you take a back up before making any changes to the server.
Remove the below entries from the Windows cleanup utility.
1.Microsoft Exchange Server
2.Microsoft Exchange 2007 Enterprise Anti-Spam Signature
3.Microsoft Exchange 2007 Enterprise Block List Update
4.Microsoft Exchange 2007 Standard Anti Spam-filter Update

Please make sure you don’t delete any other entry other then the above entry.
Reboot the server. You should be successfully able to upgrade the Exchange 2007.