WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Template Create IIS Site


; This will create a Web Site, Application Pool, and Virtual Directory for IIS 6.0

sCompName = 'MyServer'
wSiteNum = 12	;Need to determine the site number
ServerComment = "Test Site"
ServerBindings = ":80:"
DefaultDoc = "Default.htm,Default.asp,index.htm,Default.aspx"
RootDirectory = "C:\Inetpub\wwwroot\testsite"
sitePath = "C:\Inetpub\wwwroot\testsite"
AppName = "MyApp"
W3SiteName = "MyApp"
AppPoolName = StrCat(W3SiteName, "Pool")


; Creating Application Pool:
AppObj = StrCat("IIS://", sCompName, "/W3SVC/AppPools")
appPools = GetObject(AppObj)
; appPools = GetObject("IIS://localhost/w3svc/AppPools")
appPool = appPools.Create("IIsApplicationPool", AppPoolName)
appPool.SetInfo

; Create the Web Site
SiteObj = StrCat("IIS://", sCompName, "/W3SVC")
w3svc = ObjectGet(SiteObj)
; Need to check for site with same bindings etc.
NewWebServer = w3svc.create("IIsWebServer", wSiteNum)
NewWebServer.SetInfo
; Need to check to make sure you can retrieve site.  
NewWebServer.ServerComment = ServerComment
NewWebServer.KeyType="IIsWebServer"
NewWebServer.ServerBindings=ServerBindings
NewWebServer.ServerState=2	; Start the server
NewWebServer.DefaultDoc=DefaultDoc
NewWebServer.ServerAutoStart=1
NewWebServer.ServerSize=1	; The ServerSize property specifies the general size of the server, in terms of the number of client requests processed per day
NewWebServer.SetInfo


; Now create the root directory object for the Site.  
NewDir = NewWebServer.Create("IIsWebVirtualDir", "ROOT")
NewDir.Path = RootDirectory
NewDir.SetInfo
NewDir.AppCreate (@TRUE)

NewDir.AppFriendlyName=AppName
NewDir.AppPoolId=AppPoolName
NewDir.AppIsolated=2
NewDir.Path=sitePath
NewDir.Authanonymous=@TRUE
NewDir.AuthBasic=@FALSE
NewDir.AuthNTLM=@TRUE
NewDir.AccessSSL=@FALSE
NewDir.AccessSSLNegotiateCert=@FALSE
NewDir.AccessSSLRequireCert=@FALSE
NewDir.AccessSSLMapCert=@FALSE
NewDir.AspEnableParentPaths=@FALSE
NewDir.AccessRead = @True
NewDir.AccessScript = @True	; Set the Execute Permissions to Scripts Only
NewDir.SetInfo

Message("Web Site Creation", "Completed")

Article ID:   W16658
File Created: 2005:02:18:12:21:46
Last Updated: 2005:02:18:12:21:46