How to set folder permission, in a msi-package, by calling on cacls.exe with a custom action
Posted on 2009-04-12
I am a new user to Installshield and I am trying to modify an allready existing msi-package so that it grants adequate folder permissions for non-administrotr users.
I have been reading every post on the matter on InstallShield own supportforum, and everybody seem to agree that the best way of doing this is by making a custom action which calls on the DOS availible "cacls.exe" or "icacls.exe" command (located in system32 folder). Using cacls is supposed to work alot better than using the "LockPermission table" - which I have also tried to use, without any success.
Using cacls is supposed to be fairly simple. How ever no one seems to be willing to explain in a thorough way, how this is exactly is achieved. This is the command I want to use, which should grant everyone full rights on the folder and its subfolders.
icacls "C:\Program Files (x86)\program_name" /grant:r <user>:(OI)(CI)M /T /C
But since the end-users have the ability to change installation directory I would need to be able to use some kind of a environment variable that can be used in cooperation with the msi-installation. For example:
icacls "C:\[INSTALLDIR]\program_name" /grant:r <user>:(OI)(CI)M /T /C
Some people mention that they use "LaunchAppAndWait when they call for cacls, but beeing the newbie as I am, that doesnt tell me anything. Perhaps you can explain that?
I would be immensely grateful if some one could explain how this can be done, step by step, in InstallShield!