This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 8 months ago.

  • Author
  • #5456

    by lasty12 at 2013-01-21 12:38:30

    Hi all

    I am trying to apply all "users" of a machine modify permissions to an entire directory using the following script, but the permissions only appear to apply to the files within:

    [code2=powershell]icacls "c:\program files\folder" /T /C /grant users]

    Can anyone please tell me where I am going wrong?

    by DonJ at 2013-01-21 16:01:11

    That's what /t does – "all specified files in [not on] the current directory and its subdirectories." Looking at the syntax (http://technet.microsoft.com/en-us/libr ... 0%29.aspx; I don't use Icacls much myself), I don't see where it'd run differently.

    by nohandle at 2013-01-22 00:48:31

    I usually use this in cmd: icacls "c:\program files\folder" /grant users:(OI)(CI)M – the OI stands for Object Inheritance and the CI for Container Inheritance. If I am correct setting inherited permissions on the top folder is better than setting the permissions on every file separately.

    In PowerShell it does not run by default part of the command needs to be escaped. For more information about running the command with ease refer to my article here: http://www.powershellmagazine.com/2013/ ... owershell/

    by lasty12 at 2013-01-23 11:26:09

    Thanks for your responses, nohandle, I found the solution very similar to your suggestion as below – including " " around the user and parameters:

    [code2=powershell]icacls "c:\program files\folder*" /Grant "Users]

    by nohandle at 2013-01-23 12:19:58

    Hi lasty, I am glad you figured it out.
    Btw do you intent to set the permission to all folders named foldersomething or just one folder named folder? I am pointing to the asterisk wildcard.

    by lasty12 at 2013-01-23 13:55:30

    @nohandle; there are a few 'folders' prefixed by "folder" (name changed for post) so my logic to adding the * was to cover all of these eventualities. Does this sound like the correct thing to do?

    by nohandle at 2013-01-23 14:30:55

    Yes sure, just asking if you use it for a reason. 🙂

You must be logged in to reply to this topic.