HOWTO: Create Custom Application Pool from Commandline


Question


Hi,


I have a Web site configured to run in a custom application pool. The pool identify is set to a domain user.

I can change the users password using IIS Manager, but is there a command line method ?

Thanks


Answer


You can use the ADSUTIL.VBS tool to do this from the commandline (or steal the code from it for your own custom script).


The properties that you are interested in are all documented on MSDN at Metabase Properties.


The following is an example of how to create a new Application Pool called “MyAppPool” and configure it to use a custom Application Pool identity of domain\username with a password of pass. You can find all the property syntax and valid values in the MSDN. Remember, if you want to use the space character as a parameter, you have to put it in double-quotes since the commandline processor uses space as parameter delimiter.


CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\ADSUTIL.VBS CREATE w3svc/AppPools/MyAppPool IIsApplicationPool
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\ADSUTIL.VBS SET w3svc/AppPools/MyAppPool/WamUserName “domain\username”
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\ADSUTIL.VBS SET w3svc/AppPools/MyAppPool/WamUserPass “pass”
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\ADSUTIL.VBS SET w3svc/AppPools/MyAppPool/AppPoolIdentityType 3

//David

Comments (13)

  1. Kevin says:

    Nice to see you back David!.

    It’s also perhaps worthwhile mentioning that after creating the pool account, the ASP.NET 2.0 aspnet_regiis administration tool has a useful switch called "-ga" which ensures that the account is granted  the correct permissions and rights. e.g.

    aspnet_regiis -ga <appPoolAccount>

    Kev

  2. Scripting an ASP.NET installation in Win2k3

  3. bob says:

    Hi,

    I user IIS6

    I read,

    http://blogs.msdn.com/david.wang/archive/2007/12/12/howto-create-custom-application-pool-by-commandline.aspx

    and i want script same

    http://technet.microsoft.com/en-us/library/cc732992.aspx

    for change application pool of web site via command line

    can u help me ?

    Thank you,

  4. David.Wang says:

    bob – You need to modify the AppPoolId property of the specific application in the website. It is a one-liner, so please make the effort to figure it out.

    //David

  5. irinaro@cellcom.co.il says:

    Hi David,

    Can you please send me how can I cancel Idle timeout (shutdown worker processes after being idle for)  in Applacation Pool  via command line. I created the Applacation Pool  via ADSUTIL.VBS .

    Thank you vey much,

    Irina

  6. ae says:

    Hi mister,

    how can I detect if apppool is created or not ??

    thanks in advanced.

  7. ae says:

    Hi mister,

    how can I detect if apppool is created or not ??

    thanks in advanced.

  8. ae says:

    Hi all,

    can I create apppool in remote computer ?? thanks !!!

    I use XP and I want create AppPool in W2003 R2 .

    greetings

  9. Cliff says:

    I’ve set the app pool pasword several times using the above, but have never had the password work, until it is manually re-entered.

    Do you have any thoughts why the passwords are not working?

    Thanks.

  10. Kevinh says:

    Hi,

    I managed to create and edit application pools using ADSI and pstool (psexec.exe) to run remote commands on remote servers.

    Works like a charm.

    Thanks for the code David. The only reason I am using adsutil is to set a .php extension to 5.3, sadly I couldn't accomplish this via ADSI.

  11. GT says:

    "bob – You need to modify the AppPoolId property of the specific application in the website. It is a one-liner, so please make the effort to figure it out.

    //David"

    It makes me sick when I see people do this. You know the answer to a person's question, but instead of simply providing that short answer, you take the time to tell them to go work it out for themselves. What a hero you are David. I hope the next time you ask someone for help in any aspect of your life, they give you the finger and send you on your way.

  12. KFlomo says:

    2012-09-10 16:52:56 192.168.48.71 3194 192.168.0.58 80 – – – – – Timer_ConnectionIdle –

    2012-09-10 16:57:06 192.168.48.71 3199 192.168.0.58 80 – – – – – Timer_ConnectionIdle –

    2012-09-10 19:30:21 41.190.90.60 43847 192.168.0.58 80 HTTP/1.1 POST /Mobilereg.aspx 400 1253087526 BadRequest DefaultAppPool

    2012-09-10 19:44:14 41.190.90.60 56667 192.168.0.58 80 HTTP/1.1 POST /Mobilereg.aspx 400 1253087526 BadRequest DefaultAppPool

  13. Saeed says:

    Here is the complete solution with screenshots and easy steps.

    solutions-ever.blogspot.com/…/how-to-create-application-pool-in-iis.html

Skip to main content