Category Archives: Exchange

If you ever had problems with corrupt databases in an Exchange 2010 DAG setup you might have encountered this error. Trying to activate the database on a server where it has this state will fail. However there is a quite simple fix given that you have a healthy copy of the database on a different server: Update-MailboxDatabaseCopy -Identity DB<server with failed content index state> -SourceServer <server with healty copy> -CatalogOnly Run the command in the Exchange Management Shell and it should fix the Content index state and allow you to activate the database again.                  

After some exchange services failed on¬†one of the nodes in our Exchange 2010 DAG we got some problems with one database. The database was mounted on server2 where it has an activation preference of 2. Trying to manually activate the database on server1, where is has an activation preference of 1, resulted in the following error: ——————————————————– Microsoft Exchange Error ——————————————————– Cannot activate database copy ‘Activate Database Copy…’. Activate Database Copy… Failed Error: An Active Manager operation failed. Error: The database action failed. Error: Operation failed with message: MapiExceptionJetErrorAttachedDatabaseMismatch: Unable to mount database. (hr=0x80004005, ec=-1216) . [Database: DB1, Server: server1] An Active Manager operation failed. Error: Operation failed with message: MapiExceptionJetErrorAttachedDatabaseMismatch: Unable to mount database. (hr=0x80004005, ec=-1216) . [Server: server1] MapiExceptionJetErrorAttachedDatabaseMismatch: Unable to mount database. (hr=0x80004005, ec=-1216) ——————————————————– OK ——————————————————–   The solution is actually quite simple: Suspend the database copy on server1 and update the database copy. Then try…

Read more

Yesterday I was given a relatively easy task: find out who or what has a given email address. As this was within our own Exchange organization it proved to be quite simple: You can achieve the goal with a simple one-liner: get-recipient -ResultSize unlimited | where {$_.emailaddresses -match “email@address.com”} But wouldn’t it be easier to have it in a function? In Powershell, creating functions isn’t all that hard. Basically all you need to do is wrap the command or script block with a function statement, see here: function Get-EmailAddress ($emailaddress) { Get-Recipient -ResultSize unlimited | where {$_.emailaddresses -match “$emailaddress”} } See how easy that was? First you tell powershell that you want to configure a function, then the command you want to associate the function with. Within the ( ) you define what parameters the function will need. Then there’s only a { to start defining what the function will…

Read more

If you are using DAG in exchange 2010 for high availability on your mailboxes there may be one thing you might have noticed, the databases can fail over to a less preferred server at any time without you noticing. Microsoft have provided you with a script for balancing these databases, RedistributeActiveDatabases.ps1. With this script you can activate the databases on their preferred server again. But how do you know when they have failed over? That has been an issue for us for some time now. None of our monitoring solutions were able to detect this, so I decided to write a simple powershell script for this. The script uses the¬†RedistributeActiveDatabases.ps1 script to check how many, if any, databases is mounted on a less preferred server. If more than 0 databases is mounted on a less preferred server it sends a mail to a given mail address with how many databases…

Read more

Earlier I posted a script that created users and homefolders and added the users to specified groups. It also set ntfs permissions on the homefolders. That script used primarily old fashioned stuff, so I sat down and started looking for a neat way to do the same in powershell. The powershell script I came up does a lot more than the last one. Here a little list: Creates OUs Creates users Creates security groups Creates distribution groups Creates mailboxes for all users Add specified users to the correct security and distribution groups Creates a homefolder root folder and shares it Creates a homefolder for each user and sets ntfs permissions Set storage limit on the exchange mailbox database As you can see, it does quite a lot. I could incorporate more in this script, for example sharepoint and lync config, but I figured the script is long enough. If you…

Read more

In this guide I will show you how to install and configure a simple Exchange 2010 environment using no gui at all. Installing exchange 2010 without gui may seem kinda nerdy, but it’s quite useful for quickly setting up a test environment for example. Remember to run Windows update prior to the installation. Start powershell as administrator and type: import-module servermanager First we need to install all of the prerequisites: Add-WindowsFeature Web-Metabase, Web-Lgcy-Mgmt-Console, Web-Server, Web-ISAPI-Ext, Web-Metabase, Web-Lgcy-Mgmt-Console, Web-Basic-Auth, Web-ASP, Web-Digest-Auth, Web-Windows-Auth, Web-Dyn-Compression, Web-Net-Ext, RPC-over-HTTP-proxy, AS-NET-Framework, NET-HTTP-Activation We also need to set the NetTcpPortSharing service to automatic start, the command for this is: Set-service NetTcpPortSharing -startuptype automatic If you already haven’t you need to raise the forest functional level to at least Windows Server 2003 native. Before you start to install Exchange you need to prepare your Schema. If you are installing exchange on a domain controller, all you need to…

Read more

The Resource Booking Attendant should be enabled on all your Room Mailboxes. If it is not, the room will not accept or decline incoming meeting requests. Which is somewhat the whole point right? Heres a powershell command to enable it on all the Room Mailboxes in an exchange organization: Get-Mailbox -RecipientTypeDetails roommailbox | Set-CalendarProcessing -AutomateProcessing AutoAccept

If you have some sort of 3rd-party application that needs access to all of your mailboxes, it can be a pain to set the permissions on all of your mailboxes. Except if you use this nice little powershell command: Get-Mailbox -ResultSize unlimited | Add-MailboxPermission -User admin -AccessRights FullAccess -InheritanceType all What this command will do is to add Full mailbox access to every mailbox in your Exchange organization for the user admin. You can of course change the -AccessRights  setting to your liking, e.g. SendAs. You can also narrow down the number of mailboxes affected by changing the search parameter after Get-Mailbox For example if you only want to set SendAs permission on a mailboxes in a specific OU for the user admin: get-mailbox -OrganizationalUnit domain.local/ou/Users/ | Add-MailboxPermission -User admin -AccessRights SendAs -InheritanceType all

Often it’s a good idea to have a receive connector allowing certain devices to send mail through you exchange server without having to authenticate. One example from where I currently work is printers. We never set up the printers ourselves, that job is done by the provider. And do we want to give them a username and password allowing for mail relay through our servers? No, we don’t. It’s a better practice to have them only input the name/ip-address of one exchange server with the cas role. Then all we have to do is add the ip-address of the printer to the list of allowed ip’s on our receive connector. Here’s a short guide on how to do it: Open up the EMC on a exchange server with the cas role and navigate to Server Configuration–>Hub transport. On the right side, click New Receive Connector… Give the new receive connector…

Read more

At work we are currently migrating to a new active directory domain. The migration hos gone rather smoothly except for a couple of users who are not able to sync mail on their phones. After a little research I found the following events in the event log on our exchange CAS server: Log Name: Application Source: MSExchange ActiveSync Date: 04.08.2011 11:00:48 Event ID: 1053 Task Category: Configuration Level: Error Keywords: Classic User: N/A Computer: <servername> Description: Exchange ActiveSync doesn’t have sufficient permissions to create the “CN=<user>,OU=<ou>,DC=<domain>,DC=local” container under Active Directory user “Active Directory operation failed on <domain controller>. This error is not retriable. Additional information: Access is denied. Active directory response: 00000005: SecErr: DSID-031521D0, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0 “. Make sure the user has inherited permission granted to domainExchange Servers to allow List, Create child, Delete child of object type “msExchangeActiveSyncDevices” and doesn’t have any deny permissions that block…

Read more

10/12