Hey guys, im making an msi and I have tested it and it works fine. The thing is the msi is a temporary app for someting and will not be deployed for a long period of time. When I decide to uninstall the msi I would like to write a single registy key back to the machine. I use Installer Design Studio to make and edit all of my msi's and I've just been toying with the custom actions in there. Ive actually written a short vbs script to add the key back because it appears that the custom action has to be scripted in vbs or jscript (or an executable). For the custom action settings I have the options of:

Custom type-
VBScript stored in custom action table *have tested this*
VBScript stored in binary table *have tested this*
VBScript installed with product
VBScript on target machine

Execution Options-
Deferred Execution User Context
Rollback Execution User Context *have tested this*
Deferred Execution System Context
Rollback Execution System Context *have tested this*

Here is the VBS-
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control Panel\Desktop\SCRNSAVE.EXE", "logon.scr", "REG_SZ"

After playing with verious combinations of the custom action and installing the msi manually and then uninstalling it again I cannot seem to get the regkey written back to the machine.

Does anyone have any ideas?
And yes, it is a Christmas screensaver ;)
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Remove the 'WScript' directive. You cannot use it in CAs because 'WScript' refers to the Windows Scripting Host engine in Windows. Windows Installer/MSI uses its own internal engine:

Set WshShell = CreateObject("WScript.Shell")
Answered 11/16/2007 by: VBScab
Red Belt

Please log in to comment
0
Thanks for the quick reply VBScab!

So - I've created a custom action called setoldscreensaver, type = VBScript stored in custom action table, execution = Rollback Execution User Context. I've then added the following two lines:

Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control Panel\Desktop\SCRNSAVE.EXE", "logon.scr", "REG_SZ"

I Installed the msi manually, then uninstalled the msi and it still didnt create the regkey! :'(
Im obviously still doing something wrong, any further suggestions? Also- am I right in assuming that when i make the msi and deploy it via GPO then i should be using the execution option of 'Rollback Execution System Context' because the system will be uninstalling the msi and not the user?

James
Answered 11/16/2007 by: James
Senior Yellow Belt

Please log in to comment
0
Rollback isn't the same as uninstall. Set a condition on the CA of IF REMOVE~="ALL"
Answered 11/17/2007 by: VBScab
Red Belt

Please log in to comment
0
Hey VBScab, im not sure I can set the condition of the custom action to anything other than those I listed in my first post as execution options. Ive looked through all of the custom action settings and cant find an option to manually set a condition for it. Ive included a screen shot IDS so you can see what I mean. Perhaps I sould be using another tool for the custom action?

Answered 11/19/2007 by: James
Senior Yellow Belt

Please log in to comment
0
OK, you need to do some more reading, in particular on "conditions". I'm not familiar with the authoring tool you're using (Installer Design Studio) but I'm sure it will have installed a copy of MSI.CHM. If not, you can download the Installer SDK which will contain it. Again, as I don't know this tool, I'll advise on how to proceed with Orca (another part of the SDK and something you should already know about, at the very least). I'm sure the tool must have direct access to the tables, the same as Orca does. Anyway:

- Open your MSI in Orca
- Save a backup copy somewhere as a fall-back
- Browse to the InstallExecuteSequence table
- Find your Custom Action
- In the 'Condition' column, add the text
IF REMOVE~="ALL"
- Save the MSI.
- Test
Answered 11/19/2007 by: VBScab
Red Belt

Please log in to comment
0
VBScab, you've been most helpful and I very grateful for your time. The app im using (IDS) does indeed have access to the tables in a very similar fashion to Orca- again which I am very familiar with. I was not aware of msi.chm (im embaressed to say) but it looks very detailed. All knowledge of msi's that I have has come through testing and practice. I have created the custom action like you said and I did already look in the InstallExecuteSequence table before you mentioned it but the custom action does not appear there. I have manually tried adding the name of the customaction to the InstallExecuteSequence table but I got an error. The custom action is detailed in table form as follows:

Action= setoldsaver
Type = 38
Source = <empty/null>
Target= the vbs code I wish to run

msi.chm lists Type Value 38 as being 'msidbCustomActionTypeVBScript' which I assume is correct since I wish to run vbs. Im just a little baffed as to how to get InstallExecuteSequence to reference the customaction ive added, then I can set the condition you gave me and it should run.
Answered 11/19/2007 by: James
Senior Yellow Belt

Please log in to comment
0
I did already look in the InstallExecuteSequence table before you mentioned it but the custom action does not appear there. It must be in the other sequence table, InstallUISequence, then. You'll need to move it from there into the correct table.
Answered 11/19/2007 by: VBScab
Red Belt

Please log in to comment
0
VBScab, ive tried looking in the InstallUISequence table, its not there either. The only place I can actually see it in all of the tables if in the CustomAction table. :-(
Answered 11/20/2007 by: James
Senior Yellow Belt

Please log in to comment
0
Can you ZIP the MSI and post it here for me to look at?
Answered 11/20/2007 by: VBScab
Red Belt

Please log in to comment
0
ORIGINAL: VBScab

OK, you need to do some more reading, in particular on "conditions". I'm not familiar with the authoring tool you're using (Installer Design Studio) but I'm sure it will have installed a copy of MSI.CHM. If not, you can download the Installer SDK which will contain it. Again, as I don't know this tool, I'll advise on how to proceed with Orca (another part of the SDK and something you should already know about, at the very least). I'm sure the tool must have direct access to the tables, the same as Orca does. Anyway:

- Open your MSI in Orca
- Save a backup copy somewhere as a fall-back
- Browse to the InstallExecuteSequence table
- Find your Custom Action
- In the 'Condition' column, add the text
IF REMOVE~="ALL"
- Save the MSI.
- Test



Yes what he said, the Remove= ALL condition will perform this on uninstall

Check out this page:

http://www.installshield.com/news/newsletter/0212-articles/msiconditions.asp
Answered 11/21/2007 by: Coriolus
Orange Belt

Please log in to comment
0
Thanks VB Scab, its here:

http://hydrogen.chfs.org.uk/msi/
Answered 11/22/2007 by: James
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity