PDA

View Full Version : CustomAction Help



nommos
07-23-2007, 04:12 PM
Hello,

I am currently working on a project and am pretty new with AdminStudio. In the past with the said application someone created 2 MSI's, one for an upgrade and one for a new install. Basically these two installers are two seperate vbscripts that run under custom actions during install. I really would like to combine these two to make things much easier.

Would there be a way to check to see if a folder exists and if so Run NewInstall custom action and if not run upgrade install? I understand this probably is not the way to do things and there probably much easier ways which I am learning slowly. But I need a quick fix with this:

Custom Action 1 = newinstall.vbs - Runs a new install then runs vb script and edits an xml file.

Custom Action 2 = Run Upgrade.. this just runs another script and edits the xml files currently on the system.


If I do not make any sense please give me a chance and I will try to explain more in detail.

Thanks

Cary R
07-23-2007, 06:21 PM
If I'm understanding you right, these custom actions are basically wrapping another installer, and handling maintenance configuration of an XML file.

Assuming I'm understanding you correctly, you could easily enough handle this with a single MSI file. Basically, you would create a 'System Search' to find the folder (Installation Designer -> Behavior and Logic -> System Search), and then store the folder path in a property (i.e. FOLDERFOUND), then use the property in the following conditions:

Action 1 condition (folder doesn't exist): NOT FOLDERFOUND
Action 2 condition (folder exists): FOLDERFOUND

nommos
07-23-2007, 07:47 PM
If I'm understanding you right, these custom actions are basically wrapping another installer, and handling maintenance configuration of an XML file.

Assuming I'm understanding you correctly, you could easily enough handle this with a single MSI file. Basically, you would create a 'System Search' to find the folder (Installation Designer -> Behavior and Logic -> System Search), and then store the folder path in a property (i.e. FOLDERFOUND), then use the property in the following conditions:

Action 1 condition (folder doesn't exist): NOT FOLDERFOUND
Action 2 condition (folder exists): FOLDERFOUND

Yes basically the 2 vbscripts edit the configuration of an xml file. The first VBScript edits changes to an XML file upon an upgrade. The second script edits the file with new numbers and places those in the correct area of the xml files being edited.

Now I had already created a System Search String before seeing this reply, so I am following you there. I am pretty sure you are understanding what I am trying to accomplish. And REALLY appreciate it. :D

Questions:

Do I need to create "FOLDERFOUND" in the property table?

What I would like to do is:

Action 1 condition (folder doesn't exist): NOT FOLDERFOUND

If folder does not exist goto custom action NewInstall.vbs

Action 2 condition (folder exists): FOLDERFOUND

If folder(s) exist goto custom action upgrade.vbs


Thanks again for any help! I really appreciate it.

Cary R
07-24-2007, 10:00 AM
Yes basically the 2 vbscripts edit the configuration of an xml file. The first VBScript edits changes to an XML file upon an upgrade. The second script edits the file with new numbers and places those in the correct area of the xml files being edited.

Now I had already created a System Search String before seeing this reply, so I am following you there. I am pretty sure you are understanding what I am trying to accomplish. And REALLY appreciate it. :D

Questions:

Do I need to create "FOLDERFOUND" in the property table?

What I would like to do is:

Action 1 condition (folder doesn't exist): NOT FOLDERFOUND

If folder does not exist goto custom action NewInstall.vbs

Action 2 condition (folder exists): FOLDERFOUND

If folder(s) exist goto custom action upgrade.vbs


Thanks again for any help! I really appreciate it.

You're on the right track, definitely. FOLDERFOUND shouldn't actually exist in the property table beforehand. It will get created by the System Search as long as that's the property you used when you went through the System Search Wizard.

Other than that, you just have to create your custom actions, schedule them, and use the above conditions.

nommos
07-24-2007, 11:36 AM
This is where I am getting a little confused on conditions properties. When I do create a system search for lets say folder DDX. I go through the wizard:

Choose the item you want to search from the list below:
"Folder path, by searching in a specific folder

Next

Foldername:
DDX

A full path:

ProgramFilesFolder

Store the value in this property:

This is where I am confused, I only recieve a drop down box from here that shows a few properties like : ARPRODUCTION, DWUSLINK, etc. Should this not create itself at this point?

Also after I go back into custom Actions I run the wizard to get to the location for the sequence and that is After Upgrade:

Install UI Condition - here is the location I need to add my condition(s) correct? When I bring down the properties drop down I do not see ARPRODUCTION. Would this be the correct location I need to add these conditions? Sorry for being a pest!

Cary R
07-24-2007, 12:42 PM
Ahh, I see where you're getting confused here.

So, at the end of the system search wizard, you'll get a list of properties that already exist in the Property table. You'll want to type your own unique property here at this point, so something like 'DDXFOUND' would work.

Then, when you're creating conditions in the Condition Builder, only a few of the most commonly used properties are available. You'll just want to type in the name of your property that you used before.

nommos
07-24-2007, 05:28 PM
Ahh, I see where you're getting confused here.

So, at the end of the system search wizard, you'll get a list of properties that already exist in the Property table. You'll want to type your own unique property here at this point, so something like 'DDXFOUND' would work.

Then, when you're creating conditions in the Condition Builder, only a few of the most commonly used properties are available. You'll just want to type in the name of your property that you used before.


I really can't believe I did not notice you were able to type your own unique property in that location. Anyways thanks, I really appreciate this help. So now that I have this created my folder search is now named DDXFOUND.

Although I am having a bit of a problem once again.(Suprise). ;) I go into the custom actions wizard and I have the following set:

Name Upgrade

Next :

Type: Run VBScript code
Stored Directly in the custom action

Next - Next

Both checked - wait for the action to finish and ignore custom action return code.

In-Script Execution set to Immediate Execution
Execution Scheduling Always Execute

Here is where I think my install fails:

I have:

Install UI Sequence
After ExecutionAction

Install UI Condition
DDXFOUND

In the condition builder I just have IDXFOUND.

For the new install I have :

Install UI Sequence:
After Upgrade(.vbs)

Install UI Condition:
NOT DDXFOUND

So I rebuild the MSI and then launch and it fails immediatley with the following in the log file:

MSI (s) (4C:28) [16:55:07:496]: Note: 1: 1708
MSI (s) (4C:28) [16:55:07:496]: Product: DDE 3.0 -- Installation operation failed.

MSI (s) (4C:28) [16:55:07:496]: Cleaning up uninstalled install packages, if any exist
MSI (s) (4C:28) [16:55:07:496]: MainEngineThread is returning 1603
=== Logging stopped: 7/24/2007 16:55:07 ===
MSI (c) (A8:80) [16:55:07:512]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (A8:80) [16:55:07:512]: MainEngineThread is returning 1603
=== Verbose logging stopped: 7/24/2007 16:55:07 ===

I know this is something in my conditions and the way I have my Custom Actions set. Would you know by looking at this what I have done wrong?

Cary R
07-24-2007, 05:56 PM
Sure, these sorts of things usually can be tracked down by having a look at the full logfile.

Usually, issues with condtions only manifest themselves as errors when something is running when it shouldn't be, though. I would say to upload the full logfile, as well as some notes on what action should be running, and what action shouldn't be running. We should be able to see who's who then.

nommos
07-24-2007, 06:23 PM
Ok I figured out why I was getting that error and I seemed to have some odd install condition that should not have been there. Now I run the installer and it installs everything but excludes the scripts pretty much ignores them. I will keep working on this and send a log file maybe tomorrow... I am a bit burned out on this... So much to learn... :rolleyes:

Thanks again if you have any ideas while I wait to get the log file please feel free to post. ;)

nommos
07-25-2007, 09:15 AM
Not sure what I am doing wrong I am unable to get my custom actions to launch. I am looking under sequences and have the following set:

Sequences > Installation >and under ExecuteAction is the location of my two vbscripts:

Run_NewInstall
Sequence Number 1267
Conditions NOT IDXFOUND

Under that I have Upgrade
Sequence Number 1295
Conditions IDXFOUND

Any ideas? I would be happy to send you the log file if you would like to look it over if you have anytime.

nommos
07-25-2007, 09:29 AM
I changed things around now I am making a little progress. :D

nommos
07-25-2007, 10:17 AM
I spoke to soon I had it working well at least the new install piece. Now I am unable to get any of this working again. Installs the application with 0 errors but fails to run the two custom actions needed for new install.vbs or upgrade.vbs.

:confused:

Cary R
07-25-2007, 10:28 AM
Sure, I could take a look at the log. I've looked at enough of them that it would be pretty quick to see where the issue is. There should be a paperclip icon available to attach a file when you make a post, so you can just upload it directly here.

nommos
07-25-2007, 11:14 AM
Sure, I could take a look at the log. I've looked at enough of them that it would be pretty quick to see where the issue is. There should be a paperclip icon available to attach a file when you make a post, so you can just upload it directly here.


Ok I have included two files. I seem to have the new install portion working correctly. What happens is if the IDXFOUND property was not found then it runs the first vbscript and everything seems to work ok with the new install. Now if the folder does exist it does not run the second custom Action "upgrade". I have attached files I think let me know if you need anything else. Thanks so much again!

nommos
07-25-2007, 11:28 AM
Ah! I noticed something in the logs:

Note: 1: 1720 2: Upgrade 3: -2146828235 4: Microsoft VBScript runtime error 5: File not found 6: 7 7: 1
Info 1720.There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action Upgrade script error -2146828235, Microsoft VBScript runtime error: File not found Line 7, Column 1,
Action ended 10:42:15: Upgrade. Return value 1.

Odd that it runs fine when it runs alone within its own msi. Hmmm...

nommos
07-25-2007, 11:44 AM
Oh my Cary! I thank you so much for your help. After you wanted the logs I did a search and found the upgrade.vbs location in the log file and noticed the vbscript was giving me an error! I fixed the code and now I think it is almost functioning correctly! I am so greatful for you pointing me in the right direction. I may have more questions if you do not mind. THANK YOU!!!! :D

One question I would have would be how do I get this custom action to work if someone goes into add/remove programs and wants to modify the application? What I would like to do is call NewInstall.vbs again? This would be incase they would like to add another number that gets written to an xml file from the newinstall.vbs.

Cary R
07-25-2007, 12:27 PM
Here's the guilty entry from the logfile:

Action start 10:47:51: Upgrade.
MSI (s) (B4:88) [10:47:51:888]: Note: 1: 1720 2: Upgrade 3: -2146828235 4: Microsoft VBScript runtime error 5: File not found 6: 76 7: 1

1720 means that the vbscript action couldn't be run because the *.vbs file wasn't present where it was expected.

Did you say that the Upgrade action had the VBScript stored directly in the action itself? Because this would be more characteristic of if it was configured to run a file that was installed with the product, or already existing on the system.

nommos
07-25-2007, 01:01 PM
Here's the guilty entry from the logfile:

Action start 10:47:51: Upgrade.
MSI (s) (B4:88) [10:47:51:888]: Note: 1: 1720 2: Upgrade 3: -2146828235 4: Microsoft VBScript runtime error 5: File not found 6: 76 7: 1

1720 means that the vbscript action couldn't be run because the *.vbs file wasn't present where it was expected.

Did you say that the Upgrade action had the VBScript stored directly in the action itself? Because this would be more characteristic of if it was configured to run a file that was installed with the product, or already existing on the system.

Yup if you see the above post I did find that myself and figured out the problem. My vbscript had been an older version so I replaced it with my working version and everything is working correctly. And yes I have it stored directly in the action itself and it seems to be working just fine. Did you by chance see my other question in the last post? Once again thanks!

nommos
07-25-2007, 03:43 PM
Cary just wanted to say thanks for all the help. I would not have been able to complete this without your direction.

Thanks again.

Cary R
07-25-2007, 05:09 PM
Whoops! I missed that entry.

So, your question about Maintenance mode. Would this involve a third action? And if so, what would the difference between Maintenance and an Upgrade be? since launching the MSI from either ARP or from the existing MSi would both technically be maintenance.

nommos
07-26-2007, 02:49 PM
Whoops! I missed that entry.

So, your question about Maintenance mode. Would this involve a third action? And if so, what would the difference between Maintenance and an Upgrade be? since launching the MSI from either ARP or from the existing MSi would both technically be maintenance.


Pretty much would like maintenance mode to restart the Custom Action : NewInstall.vbs

nommos
07-26-2007, 06:00 PM
I am also banging my head against the wall on a simple icon file. I am unable to get this set correctly. I am trying to create a shortcut with the correct icon under the all users folder. Sigh.. :(

It keeps creating this icon file for the user that installs the app under:

C:\Documents and Settings\username\Application Data\Microsoft\Installer\{E9DE01AE-CF0C-44DA-B2B1-79E7C8009A7B}

%APPDATA%\Microsoft\Installer\{E9DE01AE-CF0C-44DA-B2B1-79E7C8009A7B}\idxshortcut_E9DE01AECF0C44DAB2B179E7C8009A7B.exe

I go into icon properties create the icon then I set the shortcut properties to but still I am getting this installed above?

Cary R
07-26-2007, 06:01 PM
I'm still not sure I understand what differentiates an 'Upgrade' from a 'Reinstall' for you, but perhaps this will help.

You say that you're trying to 'Add Another number', which I assume you would get from a user somehow. Now, the value would necessarily be stored in a property (which we'll call 'NEWVAL'), which you could then use in conditions like so:

Upgrade.vbs: DDXFOUND
NewInstall.vbs: (NOT DDXFOUND) OR NEWVAL


Now, in the case that your 'Upgrade' and 'NewInstall' scripts both run for a clean install of the MSI package (which only differs by the presence of the folder), then what you could do for Maintenance is condition the action off of the 'Installed' property:

Upgrade.vbs: DDXFOUND
NewInstall.vbs: (NOT DDXFOUND) OR Installed

Near as I can figure, one of these approaches should match what you're actually going for.

nommos
07-27-2007, 11:46 AM
Thanks for the help once again that pretty much helped me with that question. Also on the icon question I gave up on that and just ran a custom action to copy the file I needed to the all users folder with a vbscript(CA).

I have a new question (Are you suprised yet?). I would like to do a nested install with Java version 1.4_08. I understand this is not the best direction to take but I need this for a web install. After going to CA's and runing New Nested MSI I put all my information in and then save the project. I run the application and everything seems to be working then the installer fails. After looking at the logs it appears maybe they are both trying to run at the same time? I have read over a few nested installs on this board but am a little confused so I thought I might as my guru for help once again. What would be the best way to do this?

New Nested MSI
Inside the package
Source <ISProjectFolder\files needed\Java14208.msi
Target=ALLUSERS=[ALLUSERS] ADDLOCAL=ALL
Execution Scheduling = Always execute

Confused where to put the Install UI Sequence or Install Execute Sequence here is where I think I maybe messing things up. Would you be able to give me a little direction with this?

Cary R
07-27-2007, 12:57 PM
::wince::

Nested MSI's can be really difficult to make work for you. Microsoft doesn't even recommend them anymore (although, they use the word 'Deprecated').

http://msdn2.microsoft.com/en-us/library/aa368010.aspx

Basically, you need to drop them in the Execute sequence between InstallInitialize and InstallFinalize and run them in Immediate execution.

Reading through the article above, you'll probably see some of the drawbacks of the nested MSI route:

--Non-functional Add/Remove Programs entry (typically, you set ARPSYSTEMCOMPONENT to hide them)
--Difficult to maintain (i.e. target with upgrades)
--Difficult to troubleshoot if they fail

These are the ones I can think of off the top of my head. More recommended options are:

--Calling Msiexec.exe as a Custom Action from the UI sequence
--Creating a setup prerequisite that gets launched from Setup.exe

How to do all of these things is documented fairly well in the InstallShield help. See: 'Nested Installations', 'Using Msiexec.exe to Launch a Second Windows Installer Setup', 'Setup Prerequisites'

nommos
07-30-2007, 11:53 AM
Yes I really did not want to mess with nested installs from reading the microsoft site and other posts from this board. I went with Prerequisite and this worked like a charm. Just about finished and everyone is happy. Thanks for all the help. I really appreciate it.