How to Use the Get-ExchangeServer Cmdlet?

With Exchange Server 2010 SP1, Microsoft introduced several PowerShell cmdlets to perform various administrative and management tasks. The Get-ExchangeServer PowerShell cmdlet in the Exchange Management Shell (EMS) is one such cmdlet that administrators can use to view or review the Exchange Server attributes, such as name, build version number, edition, server role, etc.

In this article, you will learn how to use the Get-ExchangeServer cmdlet with and without various parameters in an on-premises Exchange Server.

Using Get-ExchangeServer Cmdlet in Exchange Server

To use the Get-ExchangeServer cmdlet, the user must have the required roles and permissions. Follow the steps below to learn what roles are required and how to assign them to the user account you are using to run the cmdlet.

Step 1: Open Exchange Management Shell (EMS) and run the following commands to display the required roles and permissions for running the Get-ExchangeServer cmdlet.

$Perms = Get-ManagementRole -Cmdlet Get-ExchangeServer
$Perms | foreach {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-Table -Auto Role,RoleAssigneeType,RoleAssigneeName}

Step 2: Assign the required roles and permissions using the New-ManagementRoleAssignment cmdlet or Exchange Admin Center (EAC).

New-ManagementRoleAssignment –Role "Organization Management" –User Administrator

Once the roles and permissions are assigned, you can run the Get-ExchangeServer cmdlet in the Exchange Management Shell with or without any parameter.

If you run the cmdlet without a parameter, it will display attributes of all the servers in your Exchange organization. If you need to check the attributes of a specific Exchange Server, use the parameters with the Get-ExchangeServer cmdlet.

Get-ExchangeServer

To retrieve information about a particular server in your Exchange organization, use the -identity parameter and specify the mailbox server name.

For instance,

Get-ExchangeServer –Identity Exchange19 | fl

To get more specific information about all the servers, such as their roles, editions, versions, etc., run the following command in the EMS.

Get-ExchangeServer | select name, serverrole, edition, admindisplayversion, isClientAccessServer | fl

You can run this command in your organization with Exchange 2019, 2016, or 2013 and mixed environments.

You can run the following command in Exchange Server 2007 and 2010 to retrieve the server attributes.

Get-ExchangeServer | select name, serverrole, edition | fl

Additionally, you can run the below script with the Get-ExchangeServer cmdlet to view the latest Security Update installed on the server. For instance,

$ExchangeServers = Get-ExchangeServer | Sort-Object Name
ForEach ($Server in $ExchangeServers) {
Invoke-Command -ComputerName $Server.Name -ScriptBlock { Get-Command Exsetup.exe | ForEach-Object { $_.FileversionInfo } }
}

Using the -Status switch, you can gather all or specific information related to the Exchange Server, including available free space, backup progress, database mount status, online maintenance progress, etc.

For instance,

Get-ExchangeServer –Status| Format-list
Get-ExchangeServer –Status| ft name,server,BackupInProgress,Mounted,OnlineMaintenanceInProgress

Similarly, you can use a few other parameters to fetch specific details or values, such as:

  • -Domain: The Domain parameter is used for filtering the output results using the domain's fully qualified domain name (FQDN). For instance, abc.com.
  • -DomainController: It specifies the Domain Controller (DC) that you can use by this cmdlet to read or write data to or from Active Directory (AD). You must identify the DC using its FQDN. For instance, dc01.abc.com.

Conclusion

In this article, you have learned how to use the Get-ExchangeServer PowerShell cmdlet to retrieve information on all or specific Exchange Servers in your organization. Administrators can use the cmdlet to analyze the Exchange Server status, detect problems, and take appropriate actions to resolve various issues.

In case there are issues or any Exchange Server has failed, you can run the recovery installation to restore the server or use an Exchange server recovery software, such as Stellar Repair for Exchange. The software can extract all mailboxes from failed Exchange Server database files, including corrupt databases, and restore them to a new or existing database hosted on another live Exchange Server or Office 365 tenant directly.



Was this article helpful?
About The Author
author image
Ravi Singh linkdin Icon

Senior Writer at Stellar®. He is an expert Tech Explainer.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received