@@ -16,39 +16,42 @@ New-Website -Name "Website1" -Port 80 -IPAddress "*" -HostHeader "" -PhysicalPat
1616
1717Import-Module WebAdministration
1818
19- New-Item - Path " IIS:\AppPools" - Name " My Pool 3" - Type AppPool
20-
21- # Older applications may require "Classic" mode, but most modern ASP.NET
22- # apps use the integrated pipeline
23- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedPipelineMode" - value " Integrated"
24-
25- # What version of the .NET runtime to use. Valid options are "v2.0" and
26- # "v4.0". IIS Manager often presents them as ".NET 4.5", but these still
27- # use the .NET 4.0 runtime so should use "v4.0".
28- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedRuntimeVersion" - value " v4.0"
29-
30- # If your ASP.NET app must run as a 32-bit process even on 64-bit machines
31- # set this to $true. This is usually only important if your app depends
32- # on some unmanaged (non-.NET) DLL's.
33- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " enable32BitAppOnWin64" - value $false
34-
35- # Starts the application pool automatically when a request is made. If you
36- # set this to false, you have to manually start the application pool or
37- # you will get 503 errors.
38- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " autoStart" - value $true
39-
40- # "AlwaysRunning" = application pool loads when Windows starts, stays running
41- # even when the application/site is idle.
42- # "OnDemand" = IIS starts it when needed. If there are no requests, it may
43- # never be started.
44- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " startMode" - value " OnDemand"
45-
46- # What account does the application pool run as?
47- # "ApplicationPoolIdentity" = best
48- # "LocalSysten" = bad idea!
49- # "NetworkService" = not so bad
50- # "SpecificUser" = useful if the user needs special rights
51- Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " processModel.identityType" - value " ApplicationPoolIdentity"
19+ $pool = Get-Item - Path " IIS:\AppPools\My Pool 3" - ErrorAction SilentlyContinue
20+ if ($pool -eq $null ) {
21+ New-Item - Path " IIS:\AppPools" - Name " My Pool 3" - Type AppPool
22+
23+ # Older applications may require "Classic" mode, but most modern ASP.NET
24+ # apps use the integrated pipeline
25+ Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedPipelineMode" - value " Integrated"
26+
27+ # What version of the .NET runtime to use. Valid options are "v2.0" and
28+ # "v4.0". IIS Manager often presents them as ".NET 4.5", but these still
29+ # use the .NET 4.0 runtime so should use "v4.0".
30+ Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " managedRuntimeVersion" - value " v4.0"
31+
32+ # If your ASP.NET app must run as a 32-bit process even on 64-bit machines
33+ # set this to $true. This is usually only important if your app depends
34+ # on some unmanaged (non-.NET) DLL's.
35+ Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " enable32BitAppOnWin64" - value $false
36+
37+ # Starts the application pool automatically when a request is made. If you
38+ # set this to false, you have to manually start the application pool or
39+ # you will get 503 errors.
40+ Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " autoStart" - value $true
41+
42+ # "AlwaysRunning" = application pool loads when Windows starts, stays running
43+ # even when the application/site is idle.
44+ # "OnDemand" = IIS starts it when needed. If there are no requests, it may
45+ # never be started.
46+ Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " startMode" - value " OnDemand"
47+
48+ # What account does the application pool run as?
49+ # "ApplicationPoolIdentity" = best
50+ # "LocalSysten" = bad idea!
51+ # "NetworkService" = not so bad
52+ # "SpecificUser" = useful if the user needs special rights
53+ Set-ItemProperty - Path " IIS:\AppPools\My Pool 3" - name " processModel.identityType" - value " ApplicationPoolIdentity"
54+ }
5255
5356# Assign application pool to website
5457Set-ItemProperty - Path " IIS:\Sites\Website1" - name " applicationPool" - value " My Pool 3"
0 commit comments