Tuesday, May 11, 2010

Recipe for installing Exchange 2010

I have now installed enough exchange2010 servers, to have made a little document, on how to do it.
It's very simple, but here's a howto, with a configuration script, on things I know I always want's to configure.
So I hope some you can use this, no matter if you need to install one server, or many.

First, install prerequisites using this MS article:
http://technet.microsoft.com/en-us/library/bb691354.aspx

E.G. when installing mb, cas and hub roles on server 2008 R2, you'll run, in PowerShell (remember to start it as Administrator):
Import-Module ServerManager
Add-WindowsFeature NET-Framework,RSAT-ADDS,Web-Server,Web-Basic-Auth,Web-Windows-Auth,Web-Metabase,Web-Net-Ext,Web-Lgcy-Mgmt-Console,WAS-Process-Model,RSAT-Web-Server,Web-ISAPI-Ext,Web-Digest-Auth,Web-Dyn-Compression,NET-HTTP-Activation,RPC-Over-HTTP-Proxy -Restart 
Set-Service NetTcpPortSharing -StartupType Automatic
Then install the Exchange server.

When installed there's always lot of things to configure. These is different, after what scenario it's installed in.
But I found, that I always need to configure these, after installing the certificate.
The following edit, the url's for the different iis dirs.
So edit, to the correct servernames, and run in powershell:

Get-OabVirtualDirectory -server SERVERNAME | Set-OabVirtualDirectory -InternalUrl https://INTERNALHOSTNAME.DOMAIN.NET/OAB -ExternalUrl https://EXTERNALHOSTNAME.DOMAIN.NET/OAB 
Get-WebServicesVirtualDirectory -server SERVERNAME | Set-WebServicesVirtualDirectory -InternalUrl https://INTERNALHOSTNAME.DOMAIN.NET/EWS/Exchange.asmx -ExternalUrl https://EXTERNALHOSTNAME.DOMAIN.NET/EWS/Exchange.asmx
Get-OwaVirtualDirectory -server SERVERNAME | Set-OwaVirtualDirectory -InternalUrl https://INTERNALHOSTNAME.DOMAIN.NET/owa -ExternalUrl https://EXTERNALHOSTNAME.DOMAIN.NET/owa
Get-EcpVirtualDirectory -server SERVERNAME | Set-EcpVirtualDirectory -InternalUrl https://INTERNALHOSTNAME.DOMAIN.NET/ecp -ExternalUrl https://EXTERNALHOSTNAME.DOMAIN.NET/ecp
Get-ActiveSyncVirtualDirectory -server SERVERNAME | Set-ActiveSyncVirtualDirectory -InternalUrl https://INTERNALHOSTNAME.DOMAIN.NET/Microsoft-Server-ActiveSync -ExternalUrl https://EXTERNALHOSTNAME.DOMAIN.NET/Microsoft-Server-ActiveSync
Get-ClientAccessServer SERVERNAME | Set-ClientAccessServer -AutoDiscoverServiceInternalUri https://INTERNALAUTDISCOVER-URL.DOMAIN.NET/Autodiscover/Autodiscover.xml
enable-OutlookAnywhere -Server 'SERVERNAME' -ExternalHostname 'EXTERNALHOSTNAME.DOMAIN.NET' -DefaultAuthenticationMethod 'Basic' -SSLOffloading $false
Input is welcome, if you need more details.

Friday, May 7, 2010

Iisreset /noforce times out in exchange 2007 and exchange 2010

On a lot of Exchange 2007 and Exchange 2010 installations, I get timeout when running:
 "Iisreset /noforce" 
You can just run the command againg, and if it times out, run it once more, untill it completes.
BUT it's annoying and you have to monitor the command, to make sure IIS is not down more that necessary.
So I have begun just to run it as follows:
"iisreset /noforce /timeout:600"
 10 minutes is usually enough time, for iis to restart :-)


Timeout error:
Attempting stop...
Restart attempt failed.
The service did not respond to the start or control request in a timely fashion. (2147943453, 8007041d)

Thursday, May 6, 2010

The operation can't be performed on the default e-mail address policy.

When Editing the default Email address policy in Exchange 2010, I always get the error:
The operation can't be performed on the default e-mail address policy. 

(Full details in the bottom)

My workaround, is to copy the details, with ctrl-c, and paste it in notepad, and edit the command, so you'll only set the needed.
E.g. I here needed to add a  domain, and make it the reply domain. So I will run the following in Powershell (remember to run powershell as administrator):
set-EmailAddressPolicy -EnabledEmailAddressTemplates 'smtp:@ADdomain.local','SMTP:@newdomain.net' -Identity 'Default Policy'

The Full error code is, when adding a domain, and setting it as default:
Error:
The operation can't be performed on the default e-mail address policy.

Exchange Management Shell command attempted:
set-EmailAddressPolicy -ConditionalDepartment @() -ConditionalCompany @() -ConditionalStateOrProvince @() -ConditionalCustomAttribute1 @() -ConditionalCustomAttribute2 @() -ConditionalCustomAttribute3 @() -ConditionalCustomAttribute4 @() -ConditionalCustomAttribute5 @() -ConditionalCustomAttribute6 @() -ConditionalCustomAttribute7 @() -ConditionalCustomAttribute8 @() -ConditionalCustomAttribute9 @() -ConditionalCustomAttribute10 @() -ConditionalCustomAttribute11 @() -ConditionalCustomAttribute12 @() -ConditionalCustomAttribute13 @() -ConditionalCustomAttribute14 @() -ConditionalCustomAttribute15 @() -RecipientContainer $null -EnabledEmailAddressTemplates 'smtp:@ADdomain.local','SMTP:@Newdomain.net' -Name 'Default Policy' -Identity 'Default Policy'

Thursday, April 8, 2010

Database failover on Exchange 2010

When a Database fail-over occurs in a DAG, the database will remain active on the new active node, until this node fails, or "ActiveServer", on the database, is changed manually.
This is a problem for me, on site servers. If they are rebooted, it is important, that the database becomes active on the site server, when it's up again.

Therefore, I have made a script, that I run from "Scheduled tasks"
Remember, that the user, that executes the script, must be member of "organization administrators"(or corresponding exchange group), local admin group for the server and have "log on as a batch job rights"


Make a scheduled task, that runs "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe c:\PSscripts\MoveDB.ps1"

I have set the script to run every morning, but could also be a startup script, but the there should be put a delay in the script.


The Powershell script, will be run from the powershell.exe, that does not know the Exchange PS commands, so I start the script with adding the exchange snapin.

The 2 liner script:
Add-PSSnapin microsoft.Exchange.Management.PowerShell.E2010
Get-MailboxDatabase DBname | where { $_.server -notlike "siteserver-servername" } | Move-ActiveMailboxDatabase -ActivateOnServer 'siteserver-servername' -MountDialOverride 'None' -Confirm:$false -TerminateOnWarning | fl >> "C:\PSscripts\MoveDB2.LOG"

Tuesday, March 30, 2010

Cannot mount database when creating a new mailbox database

When creating a new mailbox database, on Exchange 2010, I get the error:
Couldn't mount the database that you specified. Specified database: DBname; Error code: An Active Manager operation failed. Error: The Microsoft Exchange Replication service may not be running on server servername. Specific RPC error message: Error 0x6d9 (There are no more endpoints available from the endpoint mapper) from cli_MountDatabase.

After  couple of minutes, it's possible to mount the Database manually.

I  experience this everytime a create new mailbox database.
Only sollution, is to uncheck "mount this database", and then manually mount it afterwards ;-)

Friday, March 26, 2010

Setup Wizard for Update Rollup X for Exchange server 2010 (KBxxxxxx) ended prematurely

When installing Update Rollup's for Exchange 2010, on a server 2008 with AUC enabled, I get this error:
Setup Wizard for Update Rollup X for Exchange server 2010 (KBxxxxxx) ended prematurely












Of course disabling AUC is not the best option, and I discovered that this works:
Open CMD as administrator (right click, choose run as administrator) and start the "Exchange2010-KBxxxxx-x64-en.msp" from the command prompt.