running VBScript from within the MSI...
Posted 26 September 2003 - 14:27
I have an MSI which works fine. However, I wish to perform an additional task at the end of the MSI. The task has been programmed with 5 lines of VBScript.
This code works perfectly when saved as a .vbs.
Now, I have managed to get the msi to run the script, however, this seems a long way round... I have "executed a program from destination", being : cmd /c cscript c:\yadayadayada.vbs.
Now, this works, however, within Wise for Windows there is an option: "Run VBScript from embeded code". Placing this code in here doesn't work, it throws back a nice little error message 17??.
But surely, this is the reason why this option and feature is there and it clearly doesn't work. Has anyone else had this problem, or know the fix, or even think the same....
Answers greatly appreciated.
John Penford, - AVECIA Ltd.
Posted 26 September 2003 - 15:20
you start an CA type 6 and get an error.
if you use an CA type 50 (or something like that) and it works
The thing that happened to me in this area was: using wscript.quit (or something like this, eg. wscript.scriptfullname)
wscript object is not supported with CA Type 6 (i think the script engine in this case is the installer itself, not wscript or cscript)
did i catch your problem?
Posted 30 September 2003 - 13:05
set wshshell = wscript.createobject(wscript.shell).
And this is why it's failing?
Posted 01 October 2003 - 09:14
For instance, Internet Explorer adds objects that allow access to the page. Windows Installer adds objects that allow access to installer functions, for instance setting and getting objects. Look on MSDN if you want to add active scripting on your software.
And Cscript.exe, and Wscript.exe includes an object called "WScript". If I'm correct, it allows access to command-line parameters, keyboard input etc.
So, in a CA 6, the "WScript" variable does not exist, and your script fails. If you run this in a VBS, "WScript" does exist, and your script runs.
Try replacing "WScript.CreateObject" with "CreateObject".
Posted 01 October 2003 - 09:47
We distribute applictions throughout the business via MSI's, and MSI's only. I have been tasked with applying service pack 3 to MSOffice 2k and therefore have to create an msi to do this.
Currently, I have a CA for VBS:
Set WshShell = CreateObject("Wscript.Shell")
return = WshShell.Run ("c:\windows\system32\msiexec /fvd " & """" & "f:\Core\Microsoft Office 2000 SR-1 Standard\data1.msi" & """" & " reboot=reallysupress /l*v c:\windows\logs\o2ksp3.log /qb",0,True)
This command works as a seperate vbs file (subject to changing 'create object' mentioned in previous threads). An alternative would be to run a cmd prompt to call this script, however, it looks messy and I was wondering if you can 'repair/reinstall' other msi's from the 'running' msi?
Edited by mjb750q, 01 October 2003 - 09:47.
Posted 01 October 2003 - 14:11
But: you can nest installations. Look at CA type 23 and 39. Nesting also deals with reboot issues.
Posted 02 October 2003 - 09:32
I did look at those CA's but it appears that it's impossible to 'repair' as there is no property, (e.g. ADVERTISE=ALL, or INSTALLDIR etc) which starts of a repair.
Does anyone know of a repair property/value that can be set?