-
Notifications
You must be signed in to change notification settings - Fork 0
/
IIS-functions.ps1
33 lines (30 loc) · 1021 Bytes
/
IIS-functions.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
function New-WebApp{
param(
[string]$rootwebsite,
[string]$WebAppName,
[string]$AppPoolName
)
$targetpath="d:\inetpub\"+$rootwebsite+"_"+$WebAppName
New-WebApplication -name $WebAppName -Site $rootwebsite -PhysicalPath $targetpath -ApplicationPool $WebAppName -Force
}
Function add-AppPool{
Param(
[string]$PoolName,
[string]$netVersion = "4.0",
[boolean]$enable32Bit = $false,
[boolean]$classicPipelineMode = $false,
[string]$svcAccount,
[string]$svcAccountpswrd
)
New-WebAppPool -Name $PoolName
Set-ItemProperty IIS:\AppPools\$PoolName managedRuntimeVersion v$netVersion -Force
if ($enable32Bit -eq $True){Set-ItemProperty IIS:\AppPools\$PoolName enable32BitAppOnWin64 true -Force}
if ($classicPipelineMode -eq $True){Set-ItemProperty IIS:\AppPools\$siteName managedPipelineMode 1 -Force}
$pool=Get-Item IIS:\AppPools\$PoolName
$pool.processModel.username=$svcAccount
$pool.processModel.password =$svcAccountpswrd
$pool.processModel.identityType = 3
$pool|Set-Item
$pool.stop()
$pool.start()
}