Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not applicable

How do I set the AppPool Identity via script for Vista or 2008 Server IIS 7

I have an InstallScript project that was setting the AppPool identity for IIS 6 by using the IIS Object.
set objAppPools = CoGetObject("IIS://localhost/W3SVC/AppPools", "" );

However that does not seem to work under Vista / Windows Server 2008 and IIS7.

Is there a way to get the object to work or another way to do it? Maybe by setting the AppPool table Username/Password properties via script. If so an example would be appreciated.
Labels (1)
0 Kudos
(5) Replies
Level 4

There may be several answers to your question, but I'll go ahead and post what we did in case it is helpful.

We used the IIS7 Administration Pack (Reference: to automatically generate example script, which we then modified to do the job. You can export as javascript, which can be used in a jscript custom action.

The generated script will contain hard-coded values which you'd need to replace with properties from the Windows Installer session


The script generated would only work with IIS7, so you'd need to ensure it was conditioned to only run in that case.
0 Kudos
Level 3

If you make sure, the IIS6 Management Compatibility for IIS7 is switched on, your script should work without problems. You can check via script if this is turned in the regdb: HKLM\SOFTWARE\\Microsoft\\InetStp\\Components:Metabase must be set to 1.

Hope this helps

0 Kudos
Not applicable

Thanks for your replies. I found an easy way to set the AppPool Identity in script for IIS 7 using AppCmd.exe.

LaunchAppAndWait (WINSYSDIR ^ "inetsrv\\appcmd.exe", "set config -section:system.applicationHost/applicationPools /[name='MyAppPool'].processModel.userName:\"" + szAppPoolIdentity + " \" /[name='MyAppPool'].processModel.password:\"" + szAppPoolPassword + "\" /commit:apphost", LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN );
0 Kudos
Level 6

Is there any way/scripts to set pipeline mode in IIS7 (Integrated/Classic)? Thanks. 😉
0 Kudos
Level 17

I'm not sure whether there's a way to do that through script; perhaps someone else knows of a way, and they can provide a suggestion. I just wanted to point out that InstallShield 2010 has a new Managed Pipeline Mode setting that lets you specify the appropriate request-processing pipeline mode (integrated or classic) for an application pool.
0 Kudos