Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 6

Deferred Execution Custom Action Cannot Retrieve a Property Value

I am trying to add permissions to a folder using the setacl.exe tool. The problem is that it runs OK but doesn't add the permission to the folder.

I have a custom action called SetPermissions_EI (which is a new set property)
Property name: SetPermissions
Property value: [DATA]
Execution Scheduling: Always execute
Install Exec Sequence: After Launch Conditions

I have another custom actions called SetPermissions (which is a new exe stored in binary table)
commandline: -on "[CustomActionData]" -ot file -actn ace -ace "n:%COMPUTERNAME%\EVERYONE;p:FULL"
Return Processing: Asynchronous (no wait for completion)
In Script Execution: Deferred Execution in system context
Install Exec Sequence: After InstallFiles
Condition: Not Installed

I have checked the log file and the setpermission_EI runs and changes the property to the correct folder see below:

MSI (s) (48:F4) [09:36:26:015]: Doing action: SetPermissions_EI
Action 09:36:26: SetPermissions_EI.
Action start 09:36:26: SetPermissions_EI.
MSI (s) (48:F4) [09:36:26:015]: PROPERTY CHANGE: Adding SetPermissions property. Its value is 'C:\Documents and Settings\All Users\Documents\Data\'.

The log entries for the setpermissions custom action:

MSI (s) (48:F4) [09:36:32:031]: Doing action: SetPermissions
Action 09:36:32: SetPermissions.
Action start 09:36:32: SetPermissions.
Action ended 09:36:32: SetPermissions. Return value 1.

This is the part I think is causing the problem the first part of my command line -on "[CustomActionData]" is "" but then shows that CustomActionData does equal the correct property value see below:

MSI (s) (48:F4) [09:36:32:703]: Executing op: ActionStart(Name=SetPermissions,,)
Action 09:36:32: SetPermissions.
MSI (s) (48:F4) [09:36:32:703]: Executing op: CustomActionSchedule(Action=SetPermissions,ActionType=3778,Source=BinaryData,Target=-on "" -ot file -actn ace -ace "n:%COMPUTERNAME%\EVERYONE;p:FULL",CustomActionData=C:\Documents and Settings\All Users\Documents\Data\)

How do I get the CustomActionData property correctly in my command line?

Any ideas? I am sure it is something stupid.

Thanks in advance
Labels (1)
0 Kudos
(3) Replies
Flexera Alumni

[CustomActionData] is needed only for script actions (InstallScript, VBScript, JScript) to get the value of a property. As an argument to a deferred-mode executable, you can just use [PropName] since the internal MSI script that's executed during deferred mode is created during immediate mode, when the property is still available in the normal way.

That's how the common example of running notepad.exe with the argument "[INSTALLDIR]Readme.txt" works in deferred mode, for example.
0 Kudos
Level 6

thanks for the reply putting the [PropName] has fixed part of the problem.

My command line now reads -on "[DATA]" -ot file -actn ace -ace "n:%COMPUTERNAME%\EVERYONE;p:FULL"

and my log now has a path in the -on " " part.

The only problem is that the permission is still not being added this seems to be because the path in the -on "C:\Documents and Settings\All Users\Documents\Data\" ends with a \. Is there anyway to get rid of this final \?

Thanks in advance.
0 Kudos
Flexera Alumni

Directory-table properties always get a free backslash at the end, and there's no automatic way to prevent or remove it that I'm aware of. Common general practice seems to be to copy the directory property value into a Property-table property, and then use InstallScript's StrRemoveLastSlash or VBScript or something to remove the final backslash.
0 Kudos