none
Uninstall custom action

    Question

  • Hi,

    1. How can I identify in uninstall log file, that custom action for uninstall was performed?
    2. What can be reaseon that my custom uninstall action wasn't performed?

    My uninstall custom action is following Visual Basic Script stored in file startsh.vbs:

    Set WshShell = CreateObject("WScript.Shell")

    WshShell.Run """" & Property("CustomActionData") & """",7,False

    Set WshShell = Nothing

    ----

    CustomActionData is:  [TARGETDIR]deleteShortcuts.vbs

    startsh.vbs and deleteShortcuts.vbs are installed in [TARGETDIR] folder and property "Permanent" is True.

    Thanks

    Friday, August 18, 2006 8:51 AM

Answers

  • To run that uninstall custom action VBScript you just add your deleteshortcuts vbscript as a custom action and it will get called. You seem to be concerned about starting it from TARGETDIR, but I think the real issue is that you perhaps need to know what the TARGETDIR is, and this is *not* the same thing as starting your script from TARGETDIR.

    In your setup you'll have to save TARGETDIR by adding a registry item that saves it - just create a registry item with [TARGETDIR] as the value. Also add a Search Target Machine, Search for registry item that retrieves this value into a property (this search will happen on an uninstall as well as install). Now when the uninstall runs, it will have read the registry into your property value (I called it MYLOC in my test). Then you pass [MYLOC] in CustomActionData into the deleteshortcut script, where you can get the value with Property("CustomActionData").

    I've confirmed that this works as described. Having said that, if your script is literally deleting shortcuts from the start menu, it's not clear to me why you need to know TARGETDIR because you would be looking at the Start Programs menu, not TARGETDIR.

    Wednesday, August 23, 2006 7:49 PM

All replies

  • It doesn't work because TARGETDIR is not valid during an uninstall. Why not just mark the deleteshortcuts vbs file as an uninstall custom action? I'm not sure why you're using a vbs custom action to start an external vbs file.
    Monday, August 21, 2006 6:50 PM
  • > Why not just mark the deleteshortcuts vbs file as an uninstall custom action?

    Because it doesn't work.

    My external vbs is in directory where is application installed and it must be started in this directory.

    How can I get directory where is (or was) application installed?

    Could you give me advice how can I start my external script from "TARGETDIR" directory  during uninstall.

    Tuesday, August 22, 2006 5:42 AM
  • To run that uninstall custom action VBScript you just add your deleteshortcuts vbscript as a custom action and it will get called. You seem to be concerned about starting it from TARGETDIR, but I think the real issue is that you perhaps need to know what the TARGETDIR is, and this is *not* the same thing as starting your script from TARGETDIR.

    In your setup you'll have to save TARGETDIR by adding a registry item that saves it - just create a registry item with [TARGETDIR] as the value. Also add a Search Target Machine, Search for registry item that retrieves this value into a property (this search will happen on an uninstall as well as install). Now when the uninstall runs, it will have read the registry into your property value (I called it MYLOC in my test). Then you pass [MYLOC] in CustomActionData into the deleteshortcut script, where you can get the value with Property("CustomActionData").

    I've confirmed that this works as described. Having said that, if your script is literally deleting shortcuts from the start menu, it's not clear to me why you need to know TARGETDIR because you would be looking at the Start Programs menu, not TARGETDIR.

    Wednesday, August 23, 2006 7:49 PM