Use Command line to Enable IIS Web server on Windows 11

If you think GUI is not your cup of tea then use Windows Terminal (Powershell) command to install and enable Internet Information Services (IIS) on Windows 11.

Using IIS, information such as files or documents can be made available on the network. Supported communication protocols are HTTP, HTTPS, FTP, SMTP, POP3 or WebDAV, and other protocols. The web server is able to run ASP.NET applications. It competes with the Apache web server and represents an alternative to so-called LAMP-based (Linux, Apache, MySQL, PHP) systems.

This article will explain the command to install IIS using PowerShell on Windows 11.

Powershell Command to enable Internet Information Services on Windows 11

1. Open Windows Terminal (Powershell)

On your Windows 11 operating system, right-click on the Start button and select the “Windows Terminal (Admin)” option.

Run Windows 11 Terminal Admin

 

2.  Command to install IIS on Windows 11

Next, run just the given command syntax to enable whatever service you want, and the same can be used for IIS and its components as well.

Enable-WindowsOptionalFeature -Online -FeatureName <service-name>

Let’s say we want to use the above syntax to enable- IIS, common features, Management console, and more… The command will be:
______________________________________________________

Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing

_______________________________________________________

Command to enable IIS Server on Windows 11

Once it has been enabled, Press Y to restart your system.

 

3. Run IIS Server Manager

To access IIS Manager, go to the Search icon, click it, and type IIS. Once the option “Internet Information Services” appears, click to run the same.

Command to install IIS manager Windows 11

 

4. Command to restart or get the status of the webserver

Well, of course, we can restart the Web server directly from the IIS manager GUI interface, just for knowledge, this can be done using the CLI.

For the status of the running webserver

Get-Service W3SVC

To start IIS:

iisreset

 

5. Disable Internet Information Services

As we have used the command to enable the Web services, we can use the same to disable the IIS server. Here is that, simply run the given command in your Windows Terminal (Powershell) to uninstall Microsoft web server- IIS.

Disable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer

 

Other Articles: