Installing IIS with Powershell

In this resource I will explain Installing IIS with PowerShell .Till Now you might be aware of Installing IIS through UI, but now I will explain Unattended IIS installation with PowerShell script. Using this script we can install IIS in 5 min.

Please create a new .ps1 file with below script

function IsIISInstalled

$FWcheck = get-windowsfeature web-server

if (!($FWcheck -eq $null)) { return $true }


$ErrorActionPreference = "Stop"
Write-Host "Checking whether IIS installed or not..."
if (IsIISInstalled)
Write-Host "IIS already installed. "


Write-Host "IIS installation started. "

Install-WindowsFeature -Name Web-Server
Install-WindowsFeature -Name Web-Mgmt-Tools
WRITE-HOST "IIS Installation Completed"


In above script IsIISInstalled function used to check whether IIS installed or not.If IIS not installed it installs IIS with default features and IIS Management Tools.

To add new feature to IIS we can use below powershell command

Add-WindowsFeature web-http-logging

That's All. By using above script we can install IIS in any system in 5 min.

Hope this resource helps you a lot. In my next resource I will explain Unattended Installation of MS SQL SERVER 2012 with PowerShell in 15 min.


Author: ADEYEYE KAYODE BRIAN09 Jun 2014 Member Level: Bronze   Points : 0

This is a good resource that is very useful to anyone that want to install IIS with Powershell. I believed this type of resource should be posted here with detailed explanation on how to go about it.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: