Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Here is the example code.
;****************************************************************************** ; 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 ;****************************************************************************** ExitHere is the trace file from the example code.
************************************************************ *** Debug Initialized *** ============================== Thu 9/1/2005 1:51:02 PM WinBatch 32 2005C WIL DLL 5.7ceg \\logosbuild\c$\code\Logos 4.1\Utilities\VirtualDir Tool\test.exe Windows platform: NT, version: 5.2, build: 3790 (Service Pack 1) ErrorMode: @CANCEL ============================== CurrPath = FilePath(IntControl (1004, 0, 0, 0, 0)) (16) VALUE STRING => "\\logosbuild\c$\code\Logos 4.1\Utilities\VirtualDir Tool\" KeyToggleSet(@CAPSLOCK, @ON) (16) VALUE INT => 0 VirtualDir = AskLine ("Virtual Directory Creation", "Please enter the Virtual Directory Name (Virtual Directory without the underscore)", "") (36266) VALUE STRING => "wbTESTapp" NewDir = "C:\inetpub\wwwroot\\wbTESTapp" (36266) VALUE STRING => "C:\inetpub\wwwroot\\wbTESTapp" ChkDir = DirExist("C:\inetpub\wwwroot\\wbTESTapp") (36266) VALUE INT => 1 If ChkDir == @FALSE (36281) END OPERATOR KeyToggleSet(@CAPSLOCK, @OFF) (36344) VALUE INT => 1 if dsisObject(StrCat("IIS://Localhost/W3SVC/1/ROOT/",VirtualDir)) (36485) END OPERATOR NewObject = dsCreateObj("IIS://Localhost/W3SVC/1/ROOT","IIsWebVirtualDir",VirtualDir) (36516) VALUE STRING => "IIS://Localhost/W3SVC/1/ROOT/wbTESTapp" dsSetProperty(NewObject,"Path",NewDir) (42172) VALUE INT => 0 TERMINAL EXTENDER ERROR=>214 (214: Unable to set property value(s).) ;;;END OF JOB;;; ---------- Begin WWWBATCH.INI dump ---------- [Error Reporting] 3052=strcfile [COM Sub-system] Function=InvokeMember ErrorCode=9 (0x80020009) ErrorDesc=Exception occurred. ----------- End WWWBATCH.INI dump -----------
; Create the vdir objIIS = GetObject("IIS://localhost") objVdir = objIIS.Create("IIsWebVirtualDir" , "W3SVC/1/Root/TEST") objVdir.SetInfo ; Add properties objVdir.Path = "C:\Inetpub\wwwroot\Test" ;objVdir.AccessFlag = 513 ; Read and write access objVdir.AccessRead = -1 ; Read Access = TRUE objVdir.AccessWrite = -1 ; Write Access = TRUE objVdir.AuthNTLM = 0 ; No NTLM Authentication = FALSE objVdir.AppIsolated = 2 objVdir.appFriendlyName = "W3SVC/1/Root/TEST" ;objVdir.AppCreate = 0 objVdir.SetInfo Message("Success", "!") objVdir = 0 objIIS = 0Out of curiosity which IIS technology/ies are you using in C#: IIS admin objects, IIS ADSI provider and/or IIS WMI provider?
Note that you can use IIS admin objects to get the job done in WB.
Client = "MySite" ClientWIDir="C:\Inetpub\wwwroot\test2" AppName= "MySite" AppPoolName= "DefaultAppPool" ThisSite = "IIS://localhost/w3svc/1/ROOT" NewWebServer = ObjectGet(ThisSite) NewDir = NewWebServer.Create("IIsWebVirtualDir", Client) NewDir.Path = ClientWIDir NewDir.SetInfo NewDir.AppCreate (@TRUE) NewDir.AppFriendlyName=AppName NewDir.AppPoolId=AppPoolName NewDir.AppIsolated=2 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.AccessFlags=1 NewDir.SetInfo NewWebServer = "" ;Closes the object NewDir = "" ;Closes the object
The extender is taking all the necessary steps to verify that the interface in question is supported by the object before it attempts to obtain property values and the IIS admin object is reporting back that it supports the interface. I don't think there is any reasonable modification that can be made to the extender to workaround this problem. My best advice is to covert your programs to straight COM.
Article ID: W16802
File Created: 2007:07:03:14:26:18
Last Updated: 2007:07:03:14:26:18