Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (79 sloc) 3.39 KB
Install IIS Server with Web Deploy
This will install the Web Server Role including all WebServer, Health, Performance, Security, and Application features. WCF Features
will also be installed for the .NET 4.5 Framework. Web Platform Installer and Web Deploy for Hosting Servers are also installed.
After running this script your server will be ready for hosting most modern ASP.NET applications deployed directly from Visual Studio.
Author : Dan Siegel -
function IsAdministrator
$Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity)
function IsUacEnabled
(Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).EnableLua -ne 0
if (!(IsAdministrator))
if (IsUacEnabled)
[string[]]$argList = @('-NoProfile', '-NoExit', '-File', $MyInvocation.MyCommand.Path)
$argList += $MyInvocation.BoundParameters.GetEnumerator() | Foreach {"-$($_.Key)", "$($_.Value)"}
$argList += $MyInvocation.UnboundArguments
Start-Process PowerShell.exe -Verb Runas -WorkingDirectory $pwd -ArgumentList $argList
throw "You must be administrator to run this script"
$null = Start-Job -Name AddWebServer -ScriptBlock {
Add-WindowsFeature -Name "Web-Server" -IncludeManagementTools
#Web Server
Add-WindowsFeature -Name "Web-WebServer" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "Web-Health" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "Web-Performance" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "Web-Security" -IncludeAllSubFeature -IncludeManagementTools
#Application Development
Add-WindowsFeature -Name "Web-App-Dev" -IncludeAllSubFeature -IncludeManagementTools
#Management Tools
Add-WindowsFeature -Name "Web-Mgmt-Tools"
Add-WindowsFeature -Name "Web-Mgmt-Console"
Add-WindowsFeature -Name "Web-Scripting-Tools"
Add-WindowsFeature -Name "Web-Mgmt-Service"
#WCF Features
Add-WindowsFeature -Name "NET-WCF-Services45" -IncludeAllSubFeature -IncludeManagementTools
Write-Host "Installing the Web Server Role"
$null = Wait-Job -Name AddWebServer
$WPIDirectory = "$env:ProgramFiles\Microsoft\Web Platform Installer"
$null = Start-Job -Name WebPlatformInstaller -ScriptBlock {
$source = ""
$destination = "$env:USERPROFILE\Downloads\wpilauncher.exe"
Invoke-WebRequest $source -OutFile $destination
Invoke-Item -Path $destination
# We just want to wait a few seconds to ensure that WPI is installed before continuing.
Start-Sleep -Seconds 10
Write-Host "Installing the Web Platform Installer"
$null = Wait-Job -Name WebPlatformInstaller
$null = Start-Job -Name WebDeploy -ScriptBlock {
cd $WPIDirectory
.\WebpiCmd-x64.exe /Install /Products:WDeployPS /AcceptEula
Write-Host "Installing Web Deploy for Hosting Servers"
$null = Wait-Job -Name WebDeploy
Write-Host "The Web Server Role, and Web Deploy have been installed."