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.

Create IIS Virtual Directory


;******************************************************************************
;          		Program Information
;******************************************************************************
; CreateIISVirtualDir.wbt
; Created by Brad Sjue 
; Date: August 20, 2003 
; This script will create a Virtual Dir  

;******************************************************************************
;          		Initialize Program
;******************************************************************************
AddExtender("WWADS34I.dll") ; ADSI Extender 

;Optional Debugging
If IsKeyDown(@SHIFT || @CTRL)    
	sTrcFile = Strcat(Environment("TEMP"),"\~CMSWB.trc")
	If FileExist(sTrcFile) Then FileDelete(sTrcFile)
	DebugTrace(@ON,sTrcFile)
Endif

CurrPath = FilePath(IntControl (1004, 0, 0, 0, 0))

;******************************************************************************
;          		Main Program
;******************************************************************************
:Begin
KeyToggleSet(@CAPSLOCK, @ON)
VirtualDir = AskLine ("Virtual Directory Creation", "Please enter the Virtual Directory Name (Virtual Directory without the underscore)", "")

NewDir = "C:\inetpub\wwwroot\\%VirtualDir%"
ChkDir = DirExist("C:\inetpub\wwwroot\\%VirtualDir%")
If ChkDir == @FALSE
	Message("Nfuse Directory Error", "%VirtualDir% Directory Does not exist")
	Goto Begin
Endif	

KeyToggleSet(@CAPSLOCK, @OFF)

if dsisObject(StrCat("IIS://Localhost/W3SVC/1/ROOT/",VirtualDir))
dsDeleteObj(StrCat("IIS://Localhost/W3SVC/1/ROOT/",VirtualDir))
endif

NewObject = dsCreateObj("IIS://Localhost/W3SVC/1/ROOT","IIsWebVirtualDir",VirtualDir)

dsSetProperty(NewObject,"Path",NewDir) ; Path to directory
dsSetProperty(NewObject,"AccessFlags",513) ; Read and write access
dsSetProperty(NewObject,"AccessRead",-1) ; Read Access = TRUE
; dsSetProperty(NewObject,"AccessWrite",-1) ; Write Access = TRUE
; dsSetProperty(NewObject,"DontLog",0) ; DontLog = FALSE
dsSetProperty(NewObject,"AuthNTLM",0) ; No NTLM Authentication = FALSE
dsSetProperty(NewObject,"AppIsolated",2)
dsSetProperty(NewObject,"appFriendlyName",VirtualDir)
; dsSetProperty(NewObject,"AppCreate",0)
dsSetObj(NewObject) 

Message("Complete", "Done")

;******************************************************************************
;          		End of Program
;******************************************************************************
Exit
;EOF

 

Article ID:   W16330
File Created: 2005:02:18:12:19:48
Last Updated: 2005:02:18:12:19:48