I am creating app pools via power shell script.
Even after looking around i couldn't find how to set the "Start Application Pool immediately" to true. How can i do this?
Also, if the userName/password are provided then i want to set it otherwise it should be Application Pool Identity. Am i doing it correctly?
Here is the function
Function Create-AppPools($appPoolName, $appPoolDotNetVersion, $managedPipelineMode, $startMode, $userName, $password) { if(!$appPoolName){ return; } Write-Host "" #navigate to the app pools root cd IIS:\AppPools\ #check if the app pool exists if (!(Test-Path $appPoolName -pathType container)) { Write-Host "`t Creating AppPool: "+ $appPoolName #create the app pool $appPool = New-Item $appPoolName if($appPoolDotNetVersion){ $appPool | Set-ItemProperty -Name "managedRuntimeVersion" -Value $appPoolDotNetVersion } if(@managedPipelineMode){ $appPool | Set-ItemProperty -Name "managedPipelineMode" -Value $managedPipelineMode } if($startMode){ $appPool | Set-ItemProperty -Name "startMode" -Value $startMode } if($userName -and $password){ $apppool | Set-ItemProperty -Name processmodel -value @{userName = $userName;password=$password;identitytype=3} } else{ $apppool | Set-ItemProperty -Name "ProcessModel.IdentityType" -value 3 } Write-Host "`t`t AppPool: "+ $appPoolName +" created successfully" -ForegroundColor Green } else{ Write-Host "`t AppPool "+ $appPoolName +" already exists" -ForegroundColor Blue }}
Update 1: Check github for sample scripts after i got my question answered.