This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Can a VB script custom action either return a value or set a property?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 19, 2014
01:58 PM
Can a VB script custom action either return a value or set a property?
I have a VB script that returns the highest IIS website on a webserver.
I plan to use this information to make sure my new website is on the next number higher.
(using InstallShield 2012 Basic MSI)
Can the VB script set InstallShield Property values?
‘VBScript Stored in custom action’
Robert
Edited to make VB script work and write Web Site ID to MSI log file.
I plan to use this information to make sure my new website is on the next number higher.
(using InstallShield 2012 Basic MSI)
Can the VB script set InstallShield Property values?
‘VBScript Stored in custom action’
OPTION EXPLICIT
' http://www.40fingers.net/WeblogsNews/Weblogs/tabid/58/ID/21/language/en-US
' return the highest number website so install can take the next number
' usage : cscript.exe gethighestwebsitenumber.vbs //NOLOGO
' 2
DIM CRLF, TAB
DIM strServer
DIM objWebService
DIM strSiteIds
DIM strSiteHighestId
strSiteIds = ""
TAB = CHR( 9 )
CRLF = CHR( 13 ) & CHR( 10 )
strServer = "localhost"
' WScript.Echo "Enumerating websites on " & strServer & CRLF
SET objWebService = GetObject( "IIS://" & strServer & "/W3SVC" )
EnumWebsites objWebService
' Writes a message to the installer log
Function LogInfo(msg)
Dim rec, fso
Set fso = CreateObject ("Scripting.FileSystemObject")
Set rec = Session.Installer.CreateRecord(1)
rec.StringData(0) = "ServerInstall: " & msg
LogInfo = Session.Message(&H04000000, rec)
set rec = Nothing
set fso = Nothing
End Function
SUB EnumWebsites( objWebService )
DIM objWebServer, objWeb, strBindings, strBaseInfo
FOR EACH objWebServer IN objWebService
IF objWebserver.Class = "IIsWebServer" THEN
set objWeb = getObject(objWebServer.adsPath & "/Root")
' strSiteIds = strSiteIds & strComma & objWebserver.Name
strSiteHighestId = objWebserver.Name
END IF
NEXT
'Wscript.StdOut.Write strSiteHighestId
LogInfo "Highest Web Site ID: " & strSiteHighestId
END SUB
Robert
Edited to make VB script work and write Web Site ID to MSI log file.
- Tags:
- custom actions
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 21, 2014
04:36 PM
You can use the following code to set Windows Installer property value during UI Sequence and Immediate Execute Sequence.
Session.Property("PROPERTYNAME") = "PropertyValue"
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)