Writing Powershell scripts that target Exchange 2007 and 2010
If you’re planning a migration to Exchange 2010 that won’t be completed overnight, you may want to be able to run Exchange Powershell scripts that execute both Exchange 2007 and 2010 cmdlets from the same script. There’s a few reasons for doing this, including:
- If you use logic to determine where to place new user mailboxes, and some mailboxes will be on 2007 and some on 2010.
- If you create new mailboxes on Exchange 2007 and then add the new mailbox to a Exchange 2010 distribution group (for example, if you use moderated distribution groups).
- If you’re using Outlook Live (Live@EDU hosted Exchange 2010) and create MailUsers on-premise and Mailboxes in the hosted environment.
- You are using the Transporter suite to migrate mail and need to create mailboxes on a temporary Exchange 2007 server, migrate mail, and then move mailboxes to Exchange 2010.
OK – so my examples are mostly about provisioning and these are real-life examples of where I’ve used this method, but I’m sure you can think of other examples where it might be useful to you. So – what do you need?
- Exchange 2007 SP2 management tools on any OS that supports them.
- Powershell 2.0
- Remote Powershell enabled on the account you run the script as (using Set-User username –RemotePowerShellEnabled:$true)
You can use this on Windows Server 2003 R2, x86; no Exchange 2010 management tools are required. Enough of what you need – here’s what you need to put in your Powershell scripts to do Exchange 2007/2010:
# Add Exchange 2007. If you'll always run from the Exchange Management Shell, you don't need the next line.Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin# Exchange 2007 Commands Go Here - i.e.Get-MailboxDatabase# Unload Exchange 2007Remove-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin# Create Remote Powershell session with Exchange 2010 - edit the server name in ConnetionUri$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://exchange.contoso.com/powershell/ -Authentication KerberosImport-PSSession $Session# Exchange 2010 Commands Go Here - i.e.Get-MailboxDatabase# Unload Exchange 2010Remove-PSSession $Session
If you’re looking to connect to Outlook Live instead of Exchange 2010, simply replace the line beginning “$Session =” with a couple of lines similar to this:
$LiveCred = New-Object System.Management.Automation.PSCredential "yourliveadmin@contoso.edu", (ConvertTo-SecureString "password" -AsPlainText -Force)$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection -WarningAction SilentlyContinue
Hope this helps!
Steve
Enabling the Exchange 2010 ECP Performance Console
If you’ve been testing or even running Exchange 2010 in production, you will most certainly be aware of the Exchange Control Panel – which is now not only the user’s Options panel but provides access to a number of Administrative tools, such as basic user management and reporting/mailbox searches.
However one feature contained in the ECP but isn’t visible immediately is the ECP Performance Console.
The ECP Performance Console is ECP-specific in that it provides a whole wealth of information about how your Exchange Control Panel is performing – from how long client requests are taking, RPC latency down to what’s happening on the Powershell side. Although it is totally ECP specific the information can help you diagnose areas in which your client access server isn’t performing as it should and verifying improvements are working as they should.
The fields available in the ECP Performance console are as follows:
Request URL
Client Request Time (ms)
Server Request Time (ms)
RBAC Session
RBAC Session Latency (ms)
RPC Requests
RPC Latency (ms)
LDAP Requests
LDAP Latency (ms)
Serialization
Serialization Time (ms)
Runspace
Runspace Latency (ms)
Runspace Activations
Runspace Active Time (ms)
Windows PowerShell Invoke Count
Windows PowerShell Invoke Time (ms)
Cmdlets Instantiated
Cmdlet Time (ms)
Cmdlets Invoked
BeginProcessing Time (ms)
ProcessRecord Count
Process Record Time (ms)
EndProcessing Time (ms)
Authentication (ms)
Authorization (ms)
Resolve Cache (ms)
Map Request (ms)
Acquire State (ms)
Execute Handler (ms)
Release State (ms)
Update Cache (ms)
Log Request (ms)
Client Network Time (ms)
UI Response (ms)
To enable the ECP Performance Console, edit the ECP root directory’s web.config file on each Client Access server you wish to use this on. This is located at the following location:
C:\Program Files\Microsoft\Exchange Server\V14\ClientAccess\ecp\web.config
Look int he file for the following section:
<!-- Set ShowPerformanceConsole to "true" to show ECP's Perf Console: --><add key="ShowPerformanceConsole" value="false" />
Change the value for ShowPerformanceConsole to false to true as described in the preceding comment, and save the file.
Once you’ve made the change, run the customary iisreset /noforce to reset IIS then as normal login at your ECP URL (i.e. https://mail.contoso.com/ecp) and after login, click the drop-down to the right of the help icon:
You should see Performance Console now listed. Click it and voila – it should appear.
If you want to export the data - simply press the Copy button in the top left corner. The data can then be pasted into Excel.
Hope you find this useful, at some point!
Steve
Automatically install Exchange 2010 pre-requisites
This one’s a no-brainer even for those that don’t like the command line.
Exchange 2010 has a set of pre-requisites that although aren’t extensive, are a bit of a fiddle to install using the GUI. A quick way of getting them all on is to use the pre-packaged XML ServerManagerCmd Answer files provided in the scripts directory of installation media. I’ve provided a list of the most common answer files below with the respective command that can be run from inside the scripts directory .
Install Exchange Server 2010 operating system prerequisites for all server roles (Client Access, Hub Transport, Mailbox and UM)
ServerManagerCmd -ip Exchange-All.xml -Restart
Install Exchange Server 2010 operating system prerequisites for a typical installation (Client Access, Hub Transport and Mailbox)
ServerManagerCmd -ip Exchange-Typical.xml -Restart
Install Exchange Server 2010 operating system prerequisites for the Client Access server role
ServerManagerCmd -ip Exchange-CAS.xml -Restart
Install Exchange Server 2010 operating system prerequisites for the Hub transport server role
ServerManagerCmd -ip Exchange-Hub.xml -Restart
Install Exchange Server 2010 operating system prerequisites for the Mailbox server role (including Mailbox servers with Hub Transports)
ServerManagerCmd -ip Exchange-MBX.xml -Restart
Don’t forget on servers that will host the Client Access role to set the .Net TCP Port Sharing service to start automatically:
sc config NetTcpPortSharing start=auto
And on Hub Transport and Mailbox servers, install the Microsoft Filter Pack.
Exchange 2010 MCITP: EMA now available – my comments
As of today, exam 70-663 is now available to take at your local Prometic test centre. After passing 70-662, TS: Exchange 2010, Configuring this is the only exam you need to pass to become MCITP on Exchange 2010.
As someone lucky enough to take and pass the beta exam (they cancelled a LOT of places - thankfully I booked mine for Dec 1st) I can say it's certainly no harder than the Exchange 2007 MCITP exams. If you have already passed those, although there is not a specific upgrade path you won't be too dissapointed as much of the same ground is covered apart from new features, like DAG, RBAC etc.
One area where I am disappointed with the MCITP in general is that they aren't hard enough. I'm not likely to win any friends by saying that, but personally I want to feel really satified after passing the exam. With exams like the VCP getting harder I think Microsoft should follow this example and make the MCITP something that is hard to achieve; there simply is too much of a gap between MCITP and MCM/MCA and too little of a difference in skill level between MCTS and MCITP.