I can't help you with InstallScript, however, the following is a VB Script from the FMStocks 2000 example (from Microsoft) that creates a virtual directory. Perhaps this can give you an indication of where you are going wrong. I have modified this into my own VBScript CustomAction and it works fine.
I hope you can read it as the formating is lost when I paste it in.
' Force explicit declaration of all variables.
Option Explicit
dim vPath, scriptPath
scriptPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName ) -len(Wscript.ScriptName))
vPath = scriptPath & "website"
'call to create FMStocks vDir
CreateFMStocksVDir(vPath)
'code taken from mkwebdir.vbs and changed for single vDir creation.
Sub CreateFMStocksVDir(vPath)
Dim vRoot,vDir,webSite
On Error Resume Next
set webSite = findWeb("localhost", "Default Web Site")
if IsObject(webSite) then
set vRoot = webSite.GetObject("IIsWebVirtualDir", "Root")
If (Err <> 0) Then
Display "Unable to access root for " & webSite.ADsPath
Else
WScript.Echo Now & " Creating vDir FMStocks for " & vPath
Set vDir = vRoot.Create("IIsWebVirtualDir","FMStocks")
If (Err <> 0) Then
Display "Unable to create " & vRoot.ADsPath & "/FMStocks."
Else
WScript.Echo Now & " Setting vDir path"
'Set the new virtual directory path
vDir.AccessRead = true
vDir.Path = vPath
vDir.Accessflags = 529
If (Err <> 0) Then
Display "Unable to bind path " & vPath & " to " & vRoot.Name & "/FMStocks. Path may be invalid."
Else
WScript.Echo Now & " Saving vDir info"
'Save the changes
vDir.SetInfo
If (Err <> 0) Then
Display "Unable to save configuration for " & vRoot.Name & "/FMStocks."
Else
WScript.Echo Now & " FMStocks virtual directory " & vRoot.Name & "/FMStocks created successfully."
End If
End If
End If
End If
else
Display "Unable to find "& WebSiteName &" on "& ComputerName
End if
End Sub
Function findWeb(computer, webname)
On Error Resume Next
Dim websvc, site
dim webinfo
Dim aBinding, binding
set websvc = GetObject("IIS://"&computer&"/W3svc")
if (Err <> 0) then
exit function
end if
' First try to open the webname.
set site = websvc.GetObject("IIsWebServer", webname)
if (Err = 0) and (not isNull(site)) then
if (site.class = "IIsWebServer") then
' Here we found a site that is a web server.
set findWeb = site
exit function
end if
end if
err.clear
for each site in websvc
if site.class = "IIsWebServer" then
'
' First, check to see if the ServerComment
' matches
'
If site.ServerComment = webname Then
set findWeb = site
exit function
End If
aBinding=site.ServerBindings
if (IsArray(aBinding)) then
if aBinding(0) = "" then
binding = Null
else
binding = getBinding(aBinding(0))
end if
else
if aBinding = "" then
binding = Null
else
binding = getBinding(aBinding)
end if
end if
if IsArray(binding) then
if (binding(2) = webname) or (binding(0) = webname) then
set findWeb = site
exit function
End If
end if
end if
next
End Function
function getBinding(bindstr)
Dim one, two, ia, ip, hn
one=Instr(bindstr,":")
two=Instr((one+1),bindstr,":")
ia=Mid(bindstr,1,(one-1))
ip=Mid(bindstr,(one+1),((two-one)-1))
hn=Mid(bindstr,(two+1))
getBinding=Array(ia,ip,hn)
end function
Sub Display(Msg)
WScript.Echo Now & ". Error Code: " & Hex(Err) & " - " & Msg
End Sub
Sub Trace(Msg)
WScript.Echo Now & " : " & Msg
End Sub