How to Restart Internet Information Services (IIS) on Exchange Servers through PowerShell?

Newer versions of Exchange Server are getting more dependent on the web services. Several features and integrations rely on the web services in Exchange Server, like Outlook Web Access (OWA), Offline Address Book (OAB), Exchange Admin Center (EAC), Outlook Anywhere, and others. Sometimes, due to various reasons, you need to restart the Internet Information Services (IIS) on Exchange Server.

In this article, we will be going through the process of restarting the underlying Internet Information Services (IIS) on Exchange Servers.

Why would you need to restart the Exchange Server IIS?

There could be many reasons why you would need to restart the web services of the Exchange Server. Some common reasons are:

  • Installation or renewal of server certificates
  • Maintenance work
  • Setting up of two-factor authentication with Google or other suppliers
  • Issues on the server 

How to Restart IIS on Exchange Servers?

Here are the ways to restart Internet Information Services on Exchange Servers.

Restart Exchange Server IIS from Internet Information Services (IIS) Manager

You can restart the services through both the Graphical User Interface (GUI) and PowerShell. If you want to use the Internet Information Services interface approach, then you need to perform the following procedure:

  • Click on Start.
  • Click on Windows Administrative Tools.

Start Button

Note: In older versions (2016 and earlier), you need to go to Control Panel > Administrative Tools.

  • When the new pop-up opens, double-click on the Internet Information Services (IIS) Manager
  • This will open the Application Server Manager for the web services.

Application Server Manager

  • Right-click on the server’s name (in this case, it is SRV01) and click on Stop.

 

server’s name

  • In the right pane, you can see that the service is stopped. All web-related services for Exchange will not work as this service hosts several Exchange Server services (see the extract below).

service is stopped

  • Now to start the service, you just need to click on Start.

start the service

  • To check if the services are running, you can try to open the Outlook Web Access (OWA) of your server. If all goes well, the system will work.

Outlook Web Access

  • Alternatively, you can highlight the server and click on the Restart.

Restart button

Restart Exchange Server IIS from Services Control Panel

You can also restart the web services from the Services control panel in your computer. To do this, follow the given procedure:

  • Right-click on Start and click on Run.

windows run button

  • In the Run window, enter services.msc to open the Services control panel and click OK.

services.msc

  • Scroll down to find the World Wide Web Publishing Service.
  • Highlight the service and click on the Restart the service

Restart the service button

Alternatively, you can run the service in Command Prompt. Follow these steps:

  • Right-click on Start and click on Run.

windows run button

  • In the Run window, type CMD and press Enter.

Press CMD

  • In the command prompt, run the following command:
NET STOP W3SVC

NET STOP W3SVC

  • To start the service, enter the following command:
NET START W3SVC

NET START W3SVC

Restart the Exchange Server IIS Remotely for Several Servers

If you have a Database Availability Group (DAG) setup, you could have three or more servers in your setup. You cannot access them all one-by-one and run the command because you might miss one of them or forget to start the service. So, to automate the process on all servers remotely, you can use PowerShell. Here’s the process to restart IIS for several servers using PowerShell:

  • In Exchange Management Shell (EMS), run the Get-ExchangeServer command to get the list of all the Exchange Servers in your setup. You can use this to automate the restart of all the services on all servers.
  • Open Notepad or PowerShell ISE.
  • Create a new file, called Restart-IIS.ps1 and enter the following code.

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
# Get All Exchange Servers
$Servers = Get-ExchangeServer
foreach ($Server in $Servers) {
Write-Host "Restarting IIS on server: $($Server.Name)" -ForegroundColor Green
IISRESET $Server.Name
# Optional: Get the Status
Write-Host "IIS status for server $($server):"
IISRESET $server.Name /status
}
Write-host "IIS restarted on all Exchange Servers"

  • Save the file at the location recommended by Microsoft, which is C:\Scripts.
  • Open a PowerShell window as Administrator and run .\RestartIIS.ps1 to execute the command.

RestartIIS.ps1

  • The script will run. For each server in your setup, it will reset the service using the IISRESET command and will then check the status of the service.

IISRESET

The advantage of using this method is that it will restart all the services for the Internet Information Services (IIS) cleanly for all the servers in an automated way.

Conclusion

You would need to restart the Internet Information Services (IIS) whenever there is an issue or to fix a problem. However, there could be instances where there are underlying issues with the Exchange Server’s health. In such a situation, after an abrupt reboot, the databases might not mount due to corruption.

In such cases, a third-party application, such as Stellar Repair for Exchange comes in handy. With this application, you can restore all the data with efficiency and ease. The application can open any version of Exchange Server database with no size limit and in any state - dirty shutdown or clean. You can browse through the database and export the EDB data granularly to PST and other file formats. You can also use the application to export directly to a live Exchange Server database or Microsoft 365. You can export user mailboxes, archives, shared mailboxes, disabled mailboxes, and public folders.



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 STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received