How to Use Set-ServerComponentState Cmdlet in Exchange Server?

The Set-ServerComponentState command is used to set the status of a component of the Exchange Server to maintenance mode or production. This allows the administrators to move the services to another server and maintain the server with updates or hardware changes, without the services being in use. For example, if you put the hub transport in maintenance mode, no emails will pass through it. So, there is no risk of losing any email or process during maintenance. Let’s see how to use the Set-ServerComponentState command with different parameters.

How to Use the Set-ServerComponentState Command in Exchange Server?

Before you begin, you need to assign the required permissions to run the Set-ServerComponentState command.

After that, open the Exchange Management Shell and run the command as given below to set the required mode.

Set-ServerComponentState -Component -Identity -Requester -State

Set-ServerComponentState -Component

As you can see, this command will set the HubTransport component on server - SRV01 in maintenance mode.

To get the available components on the server, you can run the below command.

Get-ServerComponentState -Identity

et the HubTransport component on server

If you like to put the entire server in maintenance mode, you need to use the server wide component in the command (see the below example).

Set-ServerComponentState -Component ServerWideOffline -Identity -Requester Functional -State Active

use the server wide component in the command

The command will put the specified server in maintenance mode. To exit the maintenance mode, re-run the command but change the state to Inactive

The state should be Active or Inactive. For the Hub Transport and the Frontend Transport components, the state Draining can be used. This means that it will process the components in hand and will drain all the processes gradually.

Since the command doesn’t give much information, it’s best to re-run the Get-ServerComponentState command to confirm that the component is active or inactive.

You can use the Requester option to specify the system requesting the change of state. You can choose any of the values - HealthAPI, Maintenance, Sidelined, Functional, or Deployment. This is mandatory and is only used as a reference for troubleshooting or for auditing purposes. Although this doesn’t affect anything, it’s important that if you are setting a component as active from inactive or vice versa, the Requester is kept the same.

To ensure that there are no multiple requesters for the same component, run the below command.

$cmd = Get-ServerComponentState -Identity -Component

Check multiple requesters for the same component

If one of the requestors is inactive, the component will not activate. You will need to run the Set-ServerComponentState on every component.

To Conclude

When setting up a server or service in maintenance mode, any underlying issues may hinder the service or server from exiting the maintenance mode or vice versa. Software or hardware failure, sudden power loss, human error, no disk space, or incompatible software may render the server unusable, corrupting the database. When the transaction logs are damaged or the database is damaged, the database will not mount. In such a case, you can use an advanced Exchange Server Data Recovery application, like Stellar Repair for Exchange.

You can easily install the application on a Windows client or Server machine. You can repair the corrupt database of any version of Exchange Server and without a running Exchange Server. After repair, you can browse through the data stores. You can granularly export the EDB data, such as user mailboxes, archives, shared mailboxes, disabled mailboxes, and even public folders directly to a live Exchange Server database, with automatic mailbox matching and parallel and priority export. You can also export the recovered mailboxes to Office 365 tenant and file formats, such as PST, EML, HTML and PDF.

Was this article helpful?
About The Author
author image
Shelly Bhardwaj linkdin Icon

Shelly is technology expert and core knowledge of Exchange Server, Outlook.

Table of Contents


Why Choose Stellar?
  • 0M+


  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+


  • 0+


  • 0+

    Awards Received