Here's the code:
- - - - -
Option Explicit
CreateVirtualFolder([APP_NAME], [INSTALLDIR] & "Web\")
function CreateVirtualFolder(sName,sPath)
Dim oIIS, oDir
Set oIIS = GetObject("IIS://localhost/W3SVC/1/Root")
On Error Resume Next
Set oDir = oIIS.GetObject("IISWebVirtualDir", sName)
' This will return error -2147024893 if it doesn't exist
If Err.Number <> 0 Then Set oDir = oIIS.Create("IISWebVirtualDir", sName)
Err.Clear
oDir.AccessScript = True
oDir.Path = sPath
' Workaround for bug in II4
oDir.KeyType = "IIsWebVirtualDir"
oDir.SetInfo
oDir.AppCreate True
oDir.SetInfo
Set oDir = Nothing
Set oIIS = Nothing
end function
- - - - -
I only want to run this custom action if the web site feature is being installed, and I need to send the install path in. What do I need to change to get this working.
Thanks
- Theo