I'm writing a PowerShell script to set a UserName and Password on Identity settings in Application Pool on IIS 6 (Windows Server 2003 R2). For that purposes i'm using vbscript from here. But after running a script i still have to manually switch "Identity" from "Predefined" to "Configurable". Is there a way to select "Configurable" via powershell script?
Found solution. The following PowerShell code solves the issue.
#Assigning Identity's Username To AppPool
cscript adsutil.vbs SET w3svc/AppPools/YourAppPoolName/WAMUserName Username
#Assigning Identity's Password To AppPool
cscript adsutil.vbs SET w3svc/AppPools/YourAppPoolName/WAMUserPass Password
#Making ApplicationPool Configurable
cscript adsutil.vbs SET w3svc/AppPools/YourAppPoolName/AppPoolIdentityType 3