How to specify application pool identity user and password from PowerShell

前端 未结 4 1404
独厮守ぢ
独厮守ぢ 2021-02-02 07:44

I have been having lots of difficulty automating the setup of a Web application and configuring IIS appropriately with the Application Pool Identity. I am doing this in a Web a

4条回答
  •  野性不改
    2021-02-02 08:06

    After few experiments

    Here is my Answer, I hope this will helps , I've worked on IIS 8.5

    $credentials = (Get-Credential -Message "Please enter the Login credentials including Domain Name").GetNetworkCredential()
    
    $userName = $credentials.Domain + '\' + $credentials.UserName
    
    Set-ItemProperty IIS:\AppPools\$app_pool_name -name processModel.identityType -Value SpecificUser 
    
    Set-ItemProperty IIS:\AppPools\$app_pool_name -name processModel.userName -Value $username
    
    Set-ItemProperty IIS:\AppPools\$app_pool_name -name processModel.password -Value $credentials.Password
    

提交回复
热议问题