How does one create a website application in IIS6 from a script?

0

I'm sorry about how simple the question is but I've searched all over the Internet and I found MSDN articles about making application pools (http://msdn.microsoft.com/en-us/library/ms525309.aspx) and using IIS 7 but nothing about IIS 6 and applications.

I'm currently using the following code to create an application and set its properties:

Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Define the Path, SiteName, and PhysicalPath for the new application.
strApplicationPath = "/B2"
strSiteName = "Default Web Site"
strPhysicalPath = "C:\inetpub\wwwroot"
  ' Create the new application
oWebAdmin.Get("Application").Create "/B2", "Default Web Site", "C:\Inetpub\wwwroot\B2"

Set app = oWebAdmin.Get("Application.SiteName='Default Web Site',Path='/B2'")

app.AuthFlags = 21
app.NTAuthentication="yourfriendlydomain.helloworld.com"

However, I get 0x8004100E (Namespace specified cannot be found.) and I haven't got the faintest idea how to proceed.

iis-6
wmi
asked on Server Fault Dec 2, 2009 by Zian Choy

1 Answer

2

root\WebAdministration is new to IIS 7. Since you're using IIS 6, adsutil.vbs is the way to go, or else script it directly with ADSI.

I don't have a script to include as an example but I googled and found this: http://blogs.msdn.com/david.wang/archive/2007/12/12/howto-create-custom-application-pool-by-commandline.aspx

answered on Server Fault Dec 2, 2009 by Scott Forsyth - MVP

User contributions licensed under CC BY-SA 3.0