This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Change folder permissions
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 13, 2008
06:25 AM
Change folder permissions
In my Files & Folders view, I go to my folder for which I want to add permissions and right click on it. I go to the permissions button and I add my users and their respective permissions. When I run the setup, it seems to completely remove any existing users and their permissions and only add the users that I set in the permissions view. Is there a way that I can add user permissions to a folder without changing any existing permissions?
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 21, 2008
04:56 AM
Hi,
same Problem here. Anybody found a solution?
same Problem here. Anybody found a solution?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 21, 2008
11:54 AM
Setting permissions through InstallShield populates the LockPermissions table in the MSI package you are building. Unfortunately, the behavior you are seeing is expected behavior for the functionality provided by this table in current versions of Windows Installer (see the MSDN doc LockPermissions Table for more information).
You may try using a custom action to set permissions instead, and use a utility such as cacls to set permissions as needed through the custom action.
You may try using a custom action to set permissions instead, and use a utility such as cacls to set permissions as needed through the custom action.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 21, 2008
01:25 PM
I personally use cacls in my projects and it works magically.
In this case, %1 gets set to TARGETDIR. I use LaunchAppAndWait to call this script in a bat file.
If you don't want your users to see what's happening you can redirect cacls output to NUL ( cacls ... > NUL )
pushd c:\windows\system32
:: /T - Traverse/Recursive
:: /E - Edit ACL instead of replacing
:: /C - continue if access is denied
:: /G - grant privilege
cacls "%1\YYYYYYY" /T /C /E /G Users:F
cacls "%ALLUSERSPROFILE%\Documents\XXXXXX" /T /E /C /G Users:F
popd
:: pause
In this case, %1 gets set to TARGETDIR. I use LaunchAppAndWait to call this script in a bat file.
If you don't want your users to see what's happening you can redirect cacls output to NUL ( cacls ... > NUL )
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 16, 2008
04:52 AM
This works fine for English OS, problem is other OS languages. On a norwegian XP Pro cacls ... Users:F won't work (cacls...Brukere:F will..).
I'm trying to set permissions to my CommonAppData subfolder (installscript MSI project, IS 2009). Here's what I've tried so far.
- cacls - works fine, but is "language specific"
- LockPermissions table - cannot get this to work (using Permissions in file/folder view)
- tried some old win API scripts. Works fine, but not in vista.
Any other ideas how to get this done?
I'm trying to set permissions to my CommonAppData subfolder (installscript MSI project, IS 2009). Here's what I've tried so far.
- cacls - works fine, but is "language specific"
- LockPermissions table - cannot get this to work (using Permissions in file/folder view)
- tried some old win API scripts. Works fine, but not in vista.
Any other ideas how to get this done?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 16, 2008
05:08 AM
Hi,
I have write my own function to get a groupname from SID:
Call this function to get groupname for everyone:
Hope this helps...
I have write my own function to get a groupname from SID:
function STRING GetUserGroupFromSid(szSid, szServer)
OBJECT oWMI, oWMI2;
OBJECT oAccount;
STRING szNamespace, szResult, szAccount;
begin
try
set oWMI = CreateObject("WbemScripting.SWbemLocator");
if IsObject(oWMI) then
set oWMI2 = oWMI.ConnectServer(szServer,"root/CIMV2");
if IsObject(oWMI2) then
szNamespace = "Win32_SID.SID='" + szSid + "'";
set oAccount = oWMI2.Get(szNamespace);
if IsObject(oAccount) then
set oWMI = NOTHING;
set oWMI2 = NOTHING;
szAccount=oAccount.AccountName;
set oAccount = NOTHING;
return szAccount;
endif;
endif;
endif;
catch
return "-1";
endcatch;
end;
Call this function to get groupname for everyone:
szEveryOneGroup = GetUserGroupFromSid("S-1-1-0", ".");
Hope this helps...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 16, 2008
06:27 AM
Hi Sascha - works perfect - THANKS a lot 🙂 !
Using (as you can see) cacls.exe. Works fine on vista too, but are there any reason I should rather use icacls.exe ("Cacls on steroids" 🙂 ) for Vista?
According to this article you can get the error "Cacls is now deprecated, please use Icacls" if using cacls. I haven't seen this error myself...
Again - thanks a lot Sascha M!
// Setting full permissions for All users group
szUserGroup = GetUserGroupFromSid("S-1-1-0", ".");
szDir = svMyFolderPath;
LongPathToQuote(szDir, TRUE);
szProgram = "cacls";
szCmdLine = " " + szDir + " /T /C /E /G " + szUserGroup + ":F";
LaunchAppAndWait(szProgram, szCmdLine, WAIT | LAAW_OPTION_SHOW_HOURGLASS);
Using (as you can see) cacls.exe. Works fine on vista too, but are there any reason I should rather use icacls.exe ("Cacls on steroids" 🙂 ) for Vista?
According to this article you can get the error "Cacls is now deprecated, please use Icacls" if using cacls. I haven't seen this error myself...
Again - thanks a lot Sascha M!
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)