Can I automate the creation of a web application / .NET virtual directory in IIS 5?

I asked this. Can I automate the creation of a .NET web application in IIS? A little later, I got solutions for IIS 6 and IIS 7:

  • IIS6: iisweb /create C:\Rome "My Vacations" /d www.reskit.com /dontstart
  • IIS7: %windir%\system32\inetsrv\AppCmd ADD SITE /name:MyNewSite /bindings:http/*:81: /physicalPath:c:\inetpub\mynewsite

but I just returned the actual project to him, and it turns out I need to deploy (shock-horror) IIS 5.1

Does anyone have any ideas?

To make it clear:

I want to use IIS, but I want to create a web application automatically (ideally a batch file) without opening the Microsoft Management Console (MMC) IIS

+3
source share
1 answer

You can access the IIS 5.1 metabase in VBScript, and this will allow you to create a virtual directory. For example, this should create a virtual directory called "TestDir" that points to the folder C: \ inetpub \ wwwroot \ Test

 strComputer = "localhost" strVdirName = "TestDir" strVdirPath = "C:\Inetpub\wwwroot\Test" set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/1") set objWebSite = objIIS.GetObject("IISWebVirtualDir","Root") set objVdir = objWebSite.Create("IISWebVirtualDir",strVdirName) objVdir.AccessRead = True objVdir.Path = strVdirPath objVdir.AppCreate (True) objVdir.SetInfo WScript.Echo "Successfully created virtual directory: " & objVdir.Name 
+6
source

All Articles