cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mdbritt
Level 3

Installscript Project and IIS 7

I use Installscript projects for my installations of IIS web sites. I use WMI/ADSI to create sites, application pools etc. All works find in IIS 6. In IIS 7 (Windows server 2008), these methods no longer work during installation unless the server has IIS6 Management Compatibility enables and installed on the server. I would prefer not to have that as a requirement. I am willing to update/enhnce my InstallScript for IIS 7 and use the Microsoft.Web.Administration toolset (ServerManager) but I am not sure how I invoke this toolset in an InstallShield script in my project. Here is a snippet of what I use for IIS6. Anyone have an example for IIS 7?

if svIISVer = "6" then
svAppPool = "M5WebServices";
set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/AppPools", "");
if (IsObject(objIIS_Root)) then
try
set objAppPool = objIIS_Root.GetObject("IISApplicationPool", svAppPool);
svPoolStatus = TRUE;
catch
set objAppPool = objIIS_Root.Create("IISApplicationPool", svAppPool);
svPoolStatus = FALSE;
svLine = "Creating new App Pool";
nResult = WriteLine(nvLogFileHandle, svLine);
objAppPool.SetInfo();
endcatch;

if (IsObject(objAppPool)) then
// In minutes
objAppPool.PeriodicRestartTime = 120;
// In number of events
objAppPool.PeriodicRestartRequests = 4000;
// In bytes
objAppPool.PeriodicRestartMemory = 512000;
// In bytes
objAppPool.PeriodicRestartPrivateMemory = 196608;
endif;
set objAppPool = NOTHING;
set objIIS_Root = NOTHING;
endif;
Labels (1)
0 Kudos
(2) Replies
Mrunmayee
Level 5

Hi,

There is one inbuilt tool "AppCmd.exe" available in IIS 7 using which you ca mange your website from commandline.

Reference : http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/

I used the following command from installscript to create website on IIS 7.
"AppCmd.exe" "add site /name:\""+szWebsite+"\" /bindings:http/*:"+szTCPPort+":,https/*:"+szSSLPort+": /physicalPath:\""+szWWWRootPath+"\""

Hope, this will help you.
0 Kudos
mdbritt
Level 3

Thanks. This should work for me. It would be nice if there where InstallShield native IIS scripting methods instead.
0 Kudos