Regarding your VBS custom action, see http://blogs.msdn.com/b/robmen/archive/2004/05/20/136530.aspx (pay special attention to the 3rd point Rob M. makes).
Palbinder Sandher Software Deployment Engineer T: +44 (0) 141 945 8500 F: +44 (0) 141 945 8501 http://www.iesve.com **Design, Simulate + Innovate with the <Virtual Environment>** Integrated Environmental Solutions Limited. Registered in Scotland No. SC151456 Registered Office - Helix Building, West Of Scotland Science Park, Glasgow G20 0SP Email Disclaimer -----Original Message----- From: Roy Clemmons [mailto:roy_clemm...@hotmail.com] Sent: 18 June 2011 13:35 To: 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] External Custom Action Not Working I found the problem I was having. There was an non-displayable character in column1 1 of my vbscript file that was causing the installer to barf. To fix it, I simply created a new script file in a text editor, recompiled and it worked. Thanks to everyone that responded. Roy -----Original Message----- From: Michael Stoll [mailto:unwicht...@mistoll.de] Sent: Saturday, June 18, 2011 3:24 AM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] External Custom Action Not Working Well, here is what worked for me: ------------------ WXS ------------------- <Fragment> <InstallExecuteSequence> <Custom Action="CA_InstallIIS" Before="InstallCertificates"><![CDATA[IISMAJORVERSION = ""]]></Custom> </InstallExecuteSequence> <Binary Id="BIN_InstallIIS.vbs" SourceFile="InstallIIS\InstallIIS.vbs"/> <CustomAction Id="CA_InstallIIS" BinaryKey="BIN_InstallIIS.vbs" VBScriptCall="Install" Return="check" Execute="immediate" /> </Fragment> -------------------- VBS (InstallIIS.vbs) ---------------- option explicit const msiDoActionStatusNoAction = 0 const msiDoActionStatusSuccess = 1 const msiDoActionStatusFailure = 3 function Install() dim objWshShell, objFSO, strFile, strCommand, intRC set objWshShell = CreateObject("WScript.Shell") set objFSO = CreateObject("Scripting.FileSystemObject") if Not IsIISRequired then WriteLogMessage "Installing IIS not required." Session.Property("SKIPCONFIGUREIIS") = "1" Install = msiDoActionStatusNoAction exit function end if ' install iis WriteLogMessage "Installing IIS" SetupProgress "Installing IIS", "Installing IIS", 3 TickProgress "Initializing" strFile = objFSO.GetSpecialFolder(2) & objFSO.GetTempName WriteInstallIni strFile TickProgress "Installing" strCommand = "sysocmgr /i:..\inf\sysoc.inf /q /r /u:" & strFile intRC = objWshShell.Run(strCommand, 0, TRUE) objFSO.DeleteFile(strFile) if intRC <> 0 then WriteLogMessage "Installing IIS failed. Return code: " & intRC Install = msiDoActionStatusFailure exit function end if ' Installing ASP.NET TickProgress "Registering ASP.NET" strCommand = "%WINDIR%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe /i" intRC = objWshShell.Run(strCommand, 0 ,TRUE) ' Property("VAR_CUSTOM_ACTION_RESULT") = CStr(intRC) if intRC <> 0 then WriteLogMessage "Registering ASP.NET failed. Return code: " & intRC Install = msiDoActionStatusFailure else Install = msiDoActionStatusSuccess end if end function sub WriteInstallIni(fileName) dim objFSO, objFile set objFSO = CreateObject("Scripting.FileSystemObject") const constForWriting = 2 set objFile = objFSO.OpenTextFile(fileName, constForWriting, True) objFile.WriteLine("[Components]") objFile.WriteLine("iis_common = ON") objFile.WriteLine("iis_smtp = ON") objFile.WriteLine("iis_www = ON") objFile.WriteLine("iis_inetmgr = ON") objFile.WriteLine("aspnet=ON") objFile.WriteLine("fp_extensions=ON") objFile.Close end sub sub WriteLogMessage(text) dim msgrec Const msiMessageTypeInfo = &H04000000 ' create the message record Set msgrec = Installer.CreateRecord(1) ' field 0 is the template msgrec.StringData(0) = "Log: [1]" ' field 1, to be placed in [1] placeholder msgrec.StringData(1) = text ' send message to running installer Session.Message msiMessageTypeInfo, msgrec end sub function IsIISRequired ' product dependent IsIISRequired = true end function const msiMessageTypeProgress = &H0A000000 const msiMessageTypeActionStart = &H08000000 const msiMessageTypeActionData = &H09000000 sub SetupProgress(ActionName, ActionDescription, numTicksExpected) 'set the UI Status ACTIONSTART dim statusRecordObj, progressRecordObj set statusRecordObj = Installer.CreateRecord(3) statusRecordObj.StringData(1) = ActionName statusRecordObj.StringData(2) = ActionDescription 'below line defines a template for display on each message tick statusRecordObj.StringData(3) = "[1]" Session.Message msiMessageTypeActionStart, statusRecordObj 'resets the progress bar. set progressRecordObj = Installer.CreateRecord(4) progressRecordObj.IntegerData(1) = 0 '0 = reset bar progressRecordObj.IntegerData(2) = numTicksExpected+1 progressRecordObj.IntegerData(3) = 0 '0 = left-to-right, 1= R-to-L progressRecordObj.IntegerData(4) = 0 '0 = calc time remaining Session.Message msiMessageTypeProgress, progressRecordObj 'tell the progress bar to increment for each ActionData message progressRecordObj.IntegerData(1) = 1 'Action Info progressRecordObj.IntegerData(2) = 1 'numTicks each ActionData progressRecordObj.IntegerData(3) = 1 'increment bar for each ActionData Session.Message msiMessageTypeProgress, progressRecordObj end sub sub TickProgress(message) 'The ActionData record follows the template defined in the msiMessageTypeActionStart 'item #3. Refer to the MSI documentation related to templates. If you add more fields 'to the template, make sure to add the additional fields here as well. dim progressObject set progressObject = Installer.CreateRecord(1) progressObject.StringData(1) = message Session.Message msiMessageTypeActionData, progressObject end sub ------------------------ END --------------------------------- Am 17.06.2011 11:49, schrieb Roy Clemmons: > The script fails to run even when it does nothing: > > Sub myFunction() > End Sub > > However, when I embed the vbscript into a custom action, it works: > > <CustomAction Id="testVBScript" Script="vbscript" Execute="immediate"> > <![CDATA[ > msgbox "Hello World" > ]]> > </CustomAction> > > It's only when I try to call it externally that it fails - even when my > antivirus is turned off. > > I tried to keep the example as simple as possible, but, I'd really like to > see any code that successfully calls an external script. > > -----Original Message----- > From: Michael Stoll [mailto:unwicht...@mistoll.de] > Sent: Friday, June 17, 2011 4:27 AM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] External Custom Action Not Working > > AFAIK the msi engine does use a special host. So a vbs which runs with > wscript may be invalid with the msi scripting host. > > I once created a vbs custom action. If I remeber correctly the msi host > does not support msgbox function. > > Michael > > Am 17.06.2011 00:06, schrieb Roy Clemmons: >> I hope this didn't post twice. I didn't see it in the forum, but, forgive > me >> if this is a duplicate. >> >> All I'm trying to do is execute an external vbscript using a custom > action. >> It doesn't seem to work. A search on the forum reveals I'm not the only > one >> experiencing this problem. Someone providing a solution would provide a >> great example for those of us with the problem and for future reference. >> >> The two files are included below. Can anyone get this to work? >> >> Product.wxs >> <?xml version="1.0" encoding="UTF-8"?> >> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> >> <Product >> Id="B55596A8-93E3-47EB-84C4-D7FE07D0CAF4" >> Name="Test" >> Language="1033" >> Version="2.0.0.0" >> Manufacturer="Test Company" >> UpgradeCode="B414C827-8D81-4B4A-B3B6-338C06DE3A11"> >> >> <Package InstallerVersion="301" Compressed="yes" /> >> >> <UIRef Id="WixUI_Minimal" /> >> >> <Binary Id="myScriptVBS" SourceFile="myScript.vbs" /> >> <CustomAction Id="myScript_CA" BinaryKey="myScriptVBS" >> VBScriptCall="myFunction"></CustomAction> >> >> <InstallUISequence> >> <Custom Action="myScript_CA" After="LaunchConditions" /> >> </InstallUISequence> >> </Product> >> </Wix> >> >> myScript.vbs >> Sub myFunction() >> msgbox "Hello, World!" >> End Sub >> >> Thanks in advance. >> >> >> > ------------------------------------------------------------------------ ---- > -- >> EditLive Enterprise is the world's most technically advanced content >> authoring tool. Experience the power of Track Changes, Inline Image >> Editing and ensure content is compliant with Accessibility Checking. >> http://p.sf.net/sfu/ephox-dev2dev >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> > > ------------------------------------------------------------------------ ---- > -- > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > ------------------------------------------------------------------------ ---- -- > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------ ---- -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------ ------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users