Set Exchange Product Key with PowerShell

SNAGHTML1ca684c

By default Exchange 2007 and 2010 are installed in Trial mode so before going into production you need to enter the Product Key.

The Exchange Management Console will warn you if one or more servers are still in trial mode:

image

You can Enter the Product Key in the Server Configuration Section but you cannot enter it for all server at once:

image

Fortunately you can do this very easily using PowerShell:

# Add Exchange Snapins
if ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null) { Add-PSSnapin Microsoft.Exchange.Management.* }

# Your Product Key
$ProdKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
Get-ExchangeServer | where {$_.IsE14OrLater} | foreach {Set-ExchangeServer -Identity $_ -ProductKey $ProdKey}

Note that I am filtering for Exchange 2010 (or higher) using the IsE14OrLater property since I still have some Exchange 2003 servers. For Exchange 2007 you can combine this with the IsExchange2007OrLater property or use the ExchangeVersion property.