Hello,
Is it RESULT_PROPERTY_NEW we have to condition?
Yes, you need to condition the custom action by RESULT_PROPERTY_NEW. I've made a small typo in my previous post:
-condition this custom action with the following condition : RESULT_PROPERTY1 <> "1"
should be
-condition this custom action with the following condition : RESULT_PROPERTY_NEW <> "1"
I would recommend conditioning the custom action itself from "Execution Stage Condition" field.
How can i get the help file for vbscript which is used in custom action?
Usually our time resources are limited and we cannot help our customers with development code for their custom actions, but in your case I can help you with a small VBS. Here is an example vbscript code for your scenario :
Code: Select all
mystring = Session.Property("CustomActionData")
mystring = Right(mystring,Len(mystring) - 1)
if mystring > "1" then
mystring = CStr(CInt(mystring) - 1)
Set WshShell = CreateObject("WScript.Shell")
myKey = "HKEY_LOCAL_MACHINE\Software\YourKey\Value"
WshShell.RegWrite myKey,mystring,"REG_DWORD"
elseif mystring = "1" then
Set objRegistry = CreateObject("Wscript.Shell")
objRegistry.RegDelete "HKEY_LOCAL_MACHINE\Software\YourKey\Value"
end if
- You need to insert this code in a "Execute Inline Script Code" custom action, placed after your first vbsript custion action.
- This new custom action should run "When the system is being modified (deferred) and with "Run under the LocalSystem account with full privileges(no impersonation)".
- This custom action must be configured to run only on "Uninstall" from "Execution Stage condition" field.
- If the registry value is under the 64-bit part of the registry, the "64-bit script" option must be enabled.
- In order to be able to
access properties from a deferred custom action you need to enter the formatted reference [RESULT_PROPERTY_NEW] in the Action data field of the custom action.
This script will be executed on uninstall and will decrement the value from the registry if it is larger than 1 and it will delete the registry key if the value is 1.
Best regards,
Sorin
FOLLOW US
Get the latest news in Application Packaging