Since I am in a command-line-o mode nowadays I am trying to do more things using PowerShell. Recently I installed a server and wanted to enter the license key. Usually I’d go to the EMC and do that but this time I tried to find a cmdlet that would let me do the same.
The Set-ExchangeServer
cmdlet is your friend for this:
1 |
[PS] Set-ExchangeServer -Name EX1-2010 -ProductKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX |
This cmdlet can also be used for settings things such as Error Reporting and joining the Customer Experience Improvement Program. The cmdlet also has a counterpart called Get-ExchangeServer
that can be used to see various Exchange server settings.
1 2 3 4 |
[PS] Get-ExchangeServer Name Site ServerRole Edition AdminDisplayVersion ---- ---- ---------- ------- ------------------- EX1-2010 contoso.local/Con... Mailbox,... Standard Version 14.0 (Bu... |
It’s better to format the output as a list. That will give you more info. Or you can pipe it to the Get-Member
cmdlet to see what properties are available and then just select those. For instance:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
[PS] Get-ExchangeServer | Get-Member TypeName: Microsoft.Exchange.Data.Directory.Management.ExchangeServer Name MemberType Definition ---- ---------- ---------- Clone Method System.Object Clone() Equals Method bool Equals(System.Object obj) ... Name Property System.String Name {get;} ... OrganizationalUnit Property System.String OrganizationalUnit {get;} OrganizationId Property Microsoft.Exchange.Data.Directory.OrganizationId OrganizationId {get;} ... ProductID Property System.String ProductID {get;} RemainingTrialPeriod Property Microsoft.Exchange.Data.EnhancedTimeSpan RemainingTrialPeriod {get;} ServerRole Property Microsoft.Exchange.Data.Directory.SystemConfiguration.ServerRole Serv... Site Property Microsoft.Exchange.Data.Directory.ADObjectId Site {get;} ... [PS] Get-ExchangeServer | fl Name,Organizational*,ProductID,ServerRole,*Trial*,ServerRole,Site Name : EX1-2010 OrganizationalUnit : contoso.local/EX1-2010 ProductID : XXXX-XXX ServerRole : Mailbox, HubTransport IsExchange2007TrialEdition : False IsExpiredExchange2007TrialEdition : False RemainingTrialPeriod : 00:00:00 ServerRole : Mailbox, HubTransport Site : contoso.local/Configuration/Sites/Default-First-Site-Name |
This cmdlet also accepts the -Identity
switch to query a specified Exchange server; or a -Domain
switch to query all Exchange servers in a particular domain. If neither of these are specified the cmdlet queries all Exchange servers in the organization.
In contrast the Set-ExchangeServer
only works on one server at a time so if you need to target multiple servers you must put the command within a script.