Having problems with Creating a script used in a web setup project
(asp.net, vb): creating/deleting IIS virtual
directories.......
So, in that script I want to add a V dir (InfoViewTEST) into another
VDir (EformsTEST)
Problem is that it doesn't to anything, can anybody help?
I don't understand "On Error Resume Next" well I think...
Is there not a better way to handle errors? (If obj = null then .... in
stead of If Err.Number = 0 )
I'm new to vb scripting, so some good tutorial links will do me good,
also tips about scripting in a web setup
project.........
CODE:
-----------
Dim strVDName 'IIS Virtual Directory Name
Dim IIsWebVDir 'ADSI IIS Object
Dim objRoot 'ADSI Root Object
Dim objVdir 'ADSI Virtual Dir Object
strRootName = "EformsTEST"
strVDName = "InfoViewTEST"
On Error Resume Next
'Check if directory is already registered,
'this will produce an error if it is not
Set IIsWebVDir = GetObject("IIS://localhost/W3SVC/1/Root/strRootName/"
& strVDName)
If Err.Number = 0 Then
'No error so directory registration exists, we need to remove it
Set IIsWebVDir = Nothing
Set IIsWebVDir = GetObject(
"IIS://localhost/W3SVC/1/Root/strRootName/" & strVDName )
Set objVdir = IIsWebVDir.Delete( "IIsWebVirtualDir", strVDName)
WScript.Echo "Virtual directory gedeleted"
Else
WScript.Echo Err.Number
End If
' Use the Windows ADSI container object "Create" method to create
' a new virtual directory.
Set IIsWebVDir = GetObject("IIS://localhost/W3SVC/1/Root/strRootName")
Set IIsWebVDirObj = IIsWebVDir.Create("IIsWebVirtualDir",strVDName)
' Use the Windows ADSI object "Put" method to
' set some required properties.
IIsWebVDirObj.Put "Path", "C:\Program Files\Unique World
Software\InfoView"
IIsWebVDirObj.Put "AccessRead", True
IIsWebVDirObj.Put "AccessScript", True
' Set Directory Settings to Integrated Windows authentication (without
Anonymous acces)
IIsWebVDirObj.Put "AuthFlags", 4
' Use the Windows ADSI object "SetInfo" method to
' save the data to the metabase.
IIsWebVDirObj.SetInfo
WScript.Echo "Virtual directory gecreëerd"
>> Stay informed about: Having problems with Creating a script used in a web setup..