-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnable-IISFeature.ps1
51 lines (47 loc) · 1.18 KB
/
Enable-IISFeature.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<#
.SYNOPSIS
Install IIS on a server
#>
[CmdletBinding()]
param()
$features = "IIS-WebServerRole",
"IIS-WebServer",
"IIS-CommonHttpFeatures",
"IIS-Security",
"IIS-RequestFiltering",
"IIS-StaticContent",
"IIS-DefaultDocument",
"IIS-DirectoryBrowsing",
"IIS-HttpErrors",
"IIS-ApplicationDevelopment",
"IIS-NetFxExtensibility45",
"IIS-ISAPIExtensions",
"IIS-ISAPIFilter",
"IIS-ASPNET45",
"IIS-HealthAndDiagnostics",
"IIS-HttpLogging",
"IIS-BasicAuthentication",
"IIS-WindowsAuthentication",
"IIS-Performance",
"IIS-HttpCompressionStatic",
"IIS-WebServerManagementTools",
"IIS-ManagementConsole",
"IIS-ManagementScriptingTools",
"IIS-ManagementService",
"IIS-IIS6ManagementCompatibility",
"IIS-Metabase"
Logit "Enabling IIS Features"
$i = 0
$RestartNeeded = $false
foreach ( $feature in $features )
{
Logit -indent $feature
$result = Enable-WindowsOptionalFeature -online -FeatureName $feature
$RestartNeeded = $RestartNeeded -and $result.RestartNeeded
$i += 1
}
"Restart needed is $RestartNeeded"
Logit "Disabling Default Web Site" # since our app uses port 80
Import-Module WebAdministration
Stop-Website 'Default Web Site'
Set-ItemProperty "IIS:\Sites\Default Web Site" serverAutoStart False