@@ -12,89 +12,84 @@ cd $here
12
12
13
13
Import-Module WebAdministration
14
14
15
- if ((Test-Path " IIS:\AppPools\My Pool 3" ) -eq $False ) {
16
- New-Item - Path " IIS:\AppPools" - Name " My Pool 3" - Type AppPool
17
-
18
- Write-Host " Managed pipeline mode:"
19
- Get-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedPipelineMode"
20
-
21
- # What version of the .NET runtime to use. Valid options are "v2.0" and
22
- # "v4.0". IIS Manager often presents them as ".NET 4.5", but these still
23
- # use the .NET 4.0 runtime so should use "v4.0". For a "No Managed Code"
24
- # equivalent, pass an empty string.
25
- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedRuntimeVersion" - value " v4.0"
26
-
27
- # If your ASP.NET app must run as a 32-bit process even on 64-bit machines
28
- # set this to $true. This is usually only important if your app depends
29
- # on some unmanaged (non-.NET) DLL's.
30
- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " enable32BitAppOnWin64" - value $false
31
-
32
- # Starts the application pool automatically when a request is made. If you
33
- # set this to false, you have to manually start the application pool or
34
- # you will get 503 errors.
35
- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " autoStart" - value $true
36
-
37
- # What account does the application pool run as?
38
- # "ApplicationPoolIdentity" = best
39
- # "LocalSysten" = bad idea!
40
- # "NetworkService" = not so bad
41
- # "SpecificUser" = useful if the user needs special rights. See other examples
42
- # below for how to do this.
43
- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " processModel" - value @ {identitytype = " ApplicationPoolIdentity" }
44
-
45
- # Older applications may require "Classic" mode, but most modern ASP.NET
46
- # apps use the integrated pipeline.
47
- #
48
- # On newer versions of PowerShell, setting the managedPipelineMode is easy -
49
- # just use a string:
50
- #
51
- # Set-ItemProperty -Path "IIS:\AppPools\My Pool 3" `
52
- # -name "managedPipelineMode" `
53
- # -value "Integrated"
54
- #
55
- # However, the combination of PowerShell and the IIS module in Windows
56
- # Server 2008 and 2008 R2 requires you to specify the value as an integer.
57
- #
58
- # 0 = Integrated
59
- # 1 = Classic
60
- #
61
- # If you hate hard-coding magic numbers you can do this (or use the string
62
- # if 2008 support isn't an issue for you):
63
- #
64
- # Add-Type -Path "${env:SystemRoot}\System32\inetsrv\Microsoft.Web.Administration.dll"
65
- # $pipelineMode = [Microsoft.Web.Administration.ManagedPipelineMode]::Integrated
66
- # Set-ItemProperty -Path "..." -name "managedPipelineMode" -value ([int]$pipelineMode)
67
- #
68
- # If this DLL doesn't exist, you'll need to install the IIS Management
69
- # Console role service.
70
- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedPipelineMode" - value 0
71
-
72
- # This setting was added in IIS 8. It's different to autoStart (which means
73
- # "start the app pool when a request is made") in that it lets you keep
74
- # an app pool running at all times even when there are no requests.
75
- # Since it was added in IIS 8 you may need to check the OS version before
76
- # trying to set it.
77
- #
78
- # "AlwaysRunning" = application pool loads when Windows starts, stays running
79
- # even when the application/site is idle.
80
- # "OnDemand" = IIS starts it when needed. If there are no requests, it may
81
- # never be started.
82
- if ([Environment ]::OSVersion.Version -ge (new-object ' Version' 6 , 2 )) {
83
- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " startMode" - value " OnDemand"
84
- }
15
+ New-Item - Path " IIS:\AppPools" - Name " My Pool" - Type AppPool
16
+
17
+ # What version of the .NET runtime to use. Valid options are "v2.0" and
18
+ # "v4.0". IIS Manager often presents them as ".NET 4.5", but these still
19
+ # use the .NET 4.0 runtime so should use "v4.0". For a "No Managed Code"
20
+ # equivalent, pass an empty string.
21
+ Set-ItemProperty - Path " IIS:\AppPools\My Pool" - name " managedRuntimeVersion" - value " v4.0"
22
+
23
+ # If your ASP.NET app must run as a 32-bit process even on 64-bit machines
24
+ # set this to $true. This is usually only important if your app depends
25
+ # on some unmanaged (non-.NET) DLL's.
26
+ Set-ItemProperty - Path " IIS:\AppPools\My Pool" - name " enable32BitAppOnWin64" - value $false
27
+
28
+ # Starts the application pool automatically when a request is made. If you
29
+ # set this to false, you have to manually start the application pool or
30
+ # you will get 503 errors.
31
+ Set-ItemProperty - Path " IIS:\AppPools\My Pool" - name " autoStart" - value $true
32
+
33
+ # What account does the application pool run as?
34
+ # "ApplicationPoolIdentity" = best
35
+ # "LocalSysten" = bad idea!
36
+ # "NetworkService" = not so bad
37
+ # "SpecificUser" = useful if the user needs special rights. See other examples
38
+ # below for how to do this.
39
+ Set-ItemProperty - Path " IIS:\AppPools\My Pool" - name " processModel" - value @ {identitytype = " ApplicationPoolIdentity" }
40
+
41
+ # Older applications may require "Classic" mode, but most modern ASP.NET
42
+ # apps use the integrated pipeline.
43
+ #
44
+ # On newer versions of PowerShell, setting the managedPipelineMode is easy -
45
+ # just use a string:
46
+ #
47
+ # Set-ItemProperty -Path "IIS:\AppPools\My Pool 3" `
48
+ # -name "managedPipelineMode" `
49
+ # -value "Integrated"
50
+ #
51
+ # However, the combination of PowerShell and the IIS module in Windows
52
+ # Server 2008 and 2008 R2 requires you to specify the value as an integer.
53
+ #
54
+ # 0 = Integrated
55
+ # 1 = Classic
56
+ #
57
+ # If you hate hard-coding magic numbers you can do this (or use the string
58
+ # if 2008 support isn't an issue for you):
59
+ #
60
+ # Add-Type -Path "${env:SystemRoot}\System32\inetsrv\Microsoft.Web.Administration.dll"
61
+ # $pipelineMode = [Microsoft.Web.Administration.ManagedPipelineMode]::Integrated
62
+ # Set-ItemProperty -Path "..." -name "managedPipelineMode" -value ([int]$pipelineMode)
63
+ #
64
+ # If this DLL doesn't exist, you'll need to install the IIS Management
65
+ # Console role service.
66
+ Set-ItemProperty - Path " IIS:\AppPools\My Pool" - name " managedPipelineMode" - value 0
67
+
68
+ # This setting was added in IIS 8. It's different to autoStart (which means
69
+ # "start the app pool when a request is made") in that it lets you keep
70
+ # an app pool running at all times even when there are no requests.
71
+ # Since it was added in IIS 8 you may need to check the OS version before
72
+ # trying to set it.
73
+ #
74
+ # "AlwaysRunning" = application pool loads when Windows starts, stays running
75
+ # even when the application/site is idle.
76
+ # "OnDemand" = IIS starts it when needed. If there are no requests, it may
77
+ # never be started.
78
+ if ([Environment ]::OSVersion.Version -ge (new-object ' Version' 6 , 2 )) {
79
+ Set-ItemProperty - Path " IIS:\AppPools\My Pool" - name " startMode" - value " OnDemand"
85
80
}
86
81
87
82
# -----------------------------------------------------------------------------
88
83
# Assert
89
84
# -----------------------------------------------------------------------------
90
85
91
- if ((Get-WebAppPoolState - Name " My Pool 3 " ) -eq $null ) { Write-Error " Website1 not found" }
92
- if ((Get-ItemProperty - Path " IIS:\AppPools\My Pool 3 " - name " managedPipelineMode" ) -ne " Integrated" ) { Write-Error " Wrong pipeline mode" }
86
+ if ((Get-WebAppPoolState - Name " My Pool" ) -eq $null ) { Write-Error " Website1 not found" }
87
+ if ((Get-ItemProperty - Path " IIS:\AppPools\My Pool" - name " managedPipelineMode" ) -ne " Integrated" ) { Write-Error " Wrong pipeline mode" }
93
88
94
89
# -----------------------------------------------------------------------------
95
90
# Clean up
96
91
# -----------------------------------------------------------------------------
97
92
98
93
. ..\_Teardown.Web.ps1
99
94
100
- Remove-Item - Path " IIS:\AppPools\My Pool 3 " - Recurse - Force
95
+ Remove-Item - Path " IIS:\AppPools\My Pool" - Recurse - Force
0 commit comments