How to install IIS on Windows 10 using Powershell

An easy and quick way to install and enable IIS web services using the Powershell Command line on Windows 10 or 8/7. Along with commands to restart IIS and know the status of its running. We can also install windows authentication for IIS via PowerShell

Internet Information Services is the feature of the Windows 10/8/7 or server running Desktop or Server hardware to provide a localhost webserver. It is developed by Microsoft and only available in Windows. It supports various types of internet protocols such as HTTP, HTTP/2, HTTPS, FTP, FTPS, SMTP, and NNTP.  Although, when it comes to the online web hosting world it is not popular as Linux web servers such as Apache and Nginx, yet the IIS has a good presence and market share. Thus, if you want to try it out then here is the easy way to enable IIS web server services on Windows 10 or 7.

Install IIS from command line windows 10

As Windows come with inbuilt IIS thus we don’t need to download it, however, by default it will not enable, therefore, we install this Internet Information Services feature either by enabling it using the GUI method that is via “Turn Windows features on or off” window or using the Powershell command line.

Step 1: Run PowerShell as Admin

We need admin rights running Powershell to enable the IIS services on Windows, thus, right-click on the Windows 10 start button and select the option “Windows PowerShell (Admin)”.

Run PowerShell as Admin

Step 2: Install IIS services

IIS-WebServer Windows feature activation will not work alone, it also needs some other features to be installed such as IIS-WebServerRole, Web Management Tools, Common HTTPFeatures, HTTP Logging, Static Content Compression, Request filtering, and more.

Here are the key services which can be activated as per the requirements, however, some of them should be installed and activated with the IIS web server on Windows 10 or server platforms.  

  • IIS-WebServerRole
  • IIS-WebServer
  • IIS-CommonHttpFeatures
  • IIS-HttpErrors
  • IIS-HttpRedirect
  • IIS-ApplicationDevelopment
  • NetFx4Extended-ASPNET48
  • IIS-NetFxExtensibility48
  • IIS-HealthAndDiagnostics
  • IIS-HttpLogging
  • IIS-LoggingLibraries
  • IIS-RequestMonitor
  • IIS-HttpTracing
  • IIS-Security
  • IIS-RequestFiltering
  • IIS-Performance
  • IIS-WebServerManagementTools
  • IIS-IIS6ManagementCompatibility
  • IIS-Metabase
  • IIS-ManagementConsole
  • IIS-BasicAuthentication
  • IIS-WindowsAuthentication
  • IIS-StaticContent
  • IIS-DefaultDocument
  • IIS-WebSockets
  • IIS-ApplicationInit
  • IIS-ISAPIExtensions
  • IIS-ISAPIFilter
  • IIS-HttpCompressionStatic
  • IIS-ASPNET48

To activate any of the above services, we can use the below syntax. Just replace the <service-name> with any of the above-given services and run the command on PowerShell.

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

Thus, if we want to enable IIS and other required modules on Windows then 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

Install IIS web server and Windows Authentication on Windows 10 using Powershell command line

Run IIS Server

Now, go to the search box of Windows 10 0r 7 and type IIS; this will in return give you the option to access the Internet Information Services (IIS), Manager. Click on it to access the IIS Manager for setting up the localhost web server on Windows.

Run IIS Server

install iis from command line windows 10 powershell

Command to restart IIS webserver

For the status of the running webserver

Get-Service W3SVC

To start IIS:

iisreset

To disable the ISS server

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

To disable any particular services just mentioned at the place of  <service-name> in the below command:

Disable-WindowsOptionalFeature -Online -FeatureName <service-name>;

Other Articles: