Hello Sari,
I don't want to launch "A" folder setup.exe directly by the customer. Need to restrict this either by restrict direct launching or hide this file from the customer.
I believe there are two ways in which you can achieve this:
1. you can hide the folder, as you have mentioned. Unfortunately, we do not have predefined support for this task, therefore we may need to use a custom action (e.g. a script/executable/dll) to achieve this. As you may know, the folder object from Windows has different attributes assigned to it, one of them being the
"hidden" attribute. We can add the hidden attribute to a folder by using the
"attrib" command.
For instance, let's consider we have the following folder structure:
- folderStructure.png (128.91 KiB) Viewed 2336 times
As you can see, our folder structure looks like this:
Please note that between
"APPDIR" and
"NewFolder", there is no backslash character ("\"), as the APPDIR property, at install time, when it resolves, it already ends in a backslash character.
If we want to hide this server, we will need to add a script that will set its hidden attribute. To do so, we will need to schedule the script after the folder is created (as we can not set an attribute for a folder that does not exist). The folders are created during the
"Add resources" action group (in
"Install Execution Stage" -->
"Custom Actions" page).
For example, a PowerShell script which does that could look like this:
- script.png (125.3 KiB) Viewed 2336 times
In addition to that, few more options have to be checked (as they did not make it in the screenshot):
- Execution time --> When the system is being modified (deferred)
- Run under the LocalSystem account with full privileges (no impersonation)
- Uncheck "Uninstall" and "Maintenance" options from under "Execution Stage Condition"
What happens in the script:
- through the
"Parameters" field, we get the value of APPDIR in a variable
- we join the paths
- add the hidden attribute to our folder
This way, the folder will be hidden. However, please keep in mind that the folder can still be viewed if the appropriate option is selected by the user.
2. Another solution would be to simply restrict the user's access to the folder by setting only
"Read" permissions for that folder. This can be implemented separately towards the first method or together with it (e.g. if he user has the
"Show hidden objects" option enabled, he will still not be able to access the folder)
This can be achieved by going to
"Files and Folders" page --> right click on your folder -->
"Properties" -->
"Permissions" tab --> create a new permission as it follows:
- Permissions.png (59.21 KiB) Viewed 2336 times
This way, when the user will try to access the folder, he will receive an error, as the folder can only be read:
- error.png (47.59 KiB) Viewed 2336 times
However, please note that this might interfere with launching the application. For instance, you will need administrative privileges in order to run the setup from your setup.
Hope this helps.
Best regards,
Catalin