Hi Guys,
I am wondering, do you have an example code to list all the virtual directories under IIS?
I want the user to select which virtual directory to install into, here is my attempt which doesnt work.
OPTION EXPLICIT
Set db = Session.Database
DIM CRLF, TAB
DIM strServer
DIM objWebService
DIM combo
TAB = CHR( 9 )
CRLF = CHR( 13 ) & CHR( 10 )
combo = "CRMInstanceComboBox"
IF WScript.Arguments.Length = 1 THEN
strServer = WScript.Arguments( 0 )
ELSE
strServer = "localhost"
END IF
SET objWebService = GetObject( "IIS://" & strServer & "/W3SVC" )
EnumWebsites objWebService
MsgBox( "Yes" )
SUB EnumWebsites( objWebService )
DIM objWebServer, strBindings, index
index = 1
FOR EACH objWebServer IN objWebService
IF objWebserver.Class = "IIsWebServer" THEN
AddToCombo combo, index, objWebserver
index = index + 1
END IF
NEXT
END SUB
SUB AddToCombo( combo, index, objWebserver )
SQLCmd = "INSERT INTO " & combo & " (`Property`,`Order`,`Value`,`Text`)"
SQLCmd = SQLCmd & " VALUES ('CRMINSTANCE_PROP','" & index & "','" & objWebserver.Name & "','"
SQLCmd = SQLCmd & objWebserver.Name & "') TEMPORARY"
Set view = db.OpenView( SQLCmd )
view.Execute
END SUB
Really Really Really appreciate the help.
Tony
FOLLOW US
Get the latest news in Application Packaging