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 application deployment script written in PowerShell. My requirement is that I need my PowerShell script to set the application pool identity user to a specific service account mydomain\svcuser and password. Here is the sample code:
$pool = New-Item "IIS:\AppPools\MyAppPool" -Force $svcuser = "mydomain\svcuser" $pool.processModel.userName = $svcuser $password = "somepassword" $pool.processModel.password = $password $pool.processModel.identityType = 3 $pool | Set-Item -ErrorAction Stop
When I run this, everything appears to work correctly--no errors are thrown and the application identity user name appears in IIS--but for some reason the password does not get set correctly, if at all. Since it is a password I cannot verify whether it has been set, but I can conclude that it if it is, it is not set correctly. It will not authenticate the resulting application pool user until I manually go in and enter the password in IIS. As a result the application fails after being deployed to the Web server and requires manual intervention.
Am I missing something here?
Browse the following path on command prompt “%systemroot%system32inetsrv” and run APPCMD list apppool “Demo User” /text:* Replace “Demo User” with the App Pool name of which you want to retrieve the password. 4. Under the [processModel] section you will get the username and password which is in Clear Text .
Right-click on the application pool (EasiShare_SA) and select "Advanced Settings..." Navigate to Process Model> Identity> Click on the "MoreOptions" icon (three horizontal dots) Under Custom account > Click Select > Enter the new password in the "Password" and "Confirm Password" fields.
Go to IIS Manager > Application Pools > Your domain's specific Application Pool > Advanced Settings. In Identity: click to change > Custom Account > Set > Enter User credentials from step 2, click OK and exit all.
You would do this as follows:
Import-Module WebAdministration Set-ItemProperty IIS:\AppPools\app-pool-name -name processModel -value @{userName="user_name";password="password";identitytype=3}
See this document here for an explanation, and a reference of the indentity type numeric for the user type you will run the app pool under: http://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With