Posted in
Hosting & IIS7,
Windows Powershell |
1 Comment | 7,134 views | 16/12/2010 21:49
Powershell function to create a new application pool in IIS7.
1
2
3
4
5
6
7
8
9
10
11
| Function Create-AppPool
{
Param ($AppPool, $Username, $Password)
New-Item IIS:\AppPools\$AppPool
$NewPool = Get-Item IIS:\AppPools\$AppPool
$NewPool.ProcessModel.Username = "$Username"
$NewPool.ProcessModel.Password = "$Password"
$NewPool.ProcessModel.IdentityType = 3
$NewPool | Set-Item
} |
Function Create-AppPool
{
Param ($AppPool, $Username, $Password)
New-Item IIS:\AppPools\$AppPool
$NewPool = Get-Item IIS:\AppPools\$AppPool
$NewPool.ProcessModel.Username = "$Username"
$NewPool.ProcessModel.Password = "$Password"
$NewPool.ProcessModel.IdentityType = 3
$NewPool | Set-Item
}
You can set IdentityType for Network Service. Please check Technet for IdentityTypes.