Search code examples
powershelliis-6windows-server-2003application-pool

Application Pool Identity Predefined/Configurable switch with Powershell


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?

enter image description here


Solution

  • 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