Set ObjXML = CreateObject("SQLVDir.SQLVDirControl.3.0")
ObjXML.Connect 'Connect to the local computer and Web site "1"
Set ObjVDirs = ObjXML.SQLVDirs
Set ObjVDir = ObjVDirs.AddVirtualDirectory("nwind")
'General tab in UI
ObjVDir.PhysicalPath = "C:\Inetpub\wwwroot\Test"
'Security tab in UI
ObjVDir.UserName = "sa" 'SQL Server login
ObjVDir.Password = "password" 'SQL Server Password
'Data source tab in UI
'(local) is default for the SQL Server
ObjVDir.DatabaseName = "Northwind"
'Settings tab in UI
objVDir.AllowFlags = 8 ' only template execution is allowed
'Virtual Name Configuration tab in the UI
Set objVNames = objVDir.VirtualNames
'objVNames.AddVirtualName "dbobject", 1, ""
'The path specified for the AddVirtualName below must be a valid path.
objVNames.AddVirtualName "query", 4 , "C:\Inetpub\wwwroot\test\query"