Script Grant Full Access Permission on Multiple Folders and Sub-Folders

Hi, I'm having a issue trying to run this script. 
1.)It provides each folder with "Special" Permission over them. (Read, Write, Modify, Full control). Is there a way of making it "Full Control" Permission instead of special permission?
or
2.) Is there a way to make the Object Apply to "This Folder,sub folders and files" (when i change it manually this it changes to Full Control Access)?
What I tried doing in the following script is removing the inheritance of the folder then applying its level of authentication. I do get some errors and I'm pretty sure it's has to do with some files being password protected.
$domainG = "Domain\Group"
$dir = "X:\Folder\Folder\*\SameName"
$subfolder = Join-Path $dir "\*"
$subsubfolder = Join-Path $subfolder "\*"
$subsubsubfolder = Join-Path $subsubfolder "\*"
$subsubsubsubfolder = Join-Path $subsubsubfolder "\*"
$acl = Get-Item $dir |get-acl
#This removes inheritance
$acl.SetAccessRuleProtection($true,$true)
$acl |Set-Acl
# Gives full control
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule -ArgumentList @($domainG,"FullControl","Allow")
$acl.SetAccessRule($rule)
$acl |Set-Acl
$acl = Get-Item $subfolder |Get-Acl
# This adds full control to the subfolder
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule -ArgumentList @($domainG,"FullControl","Allow")
$acl.SetAccessRule($rule)
$acl |Set-Acl
$acl = Get-Item $subsubfolder |Get-Acl
# This adds full control to the sub sub folder
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule -ArgumentList @($domainG,"FullControl","Allow")
$acl.SetAccessRule($rule)
$acl |Set-Acl
$acl = Get-Item $subsubsubfolder |Get-Acl
# This adds full control to the sub sub subfolder
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule -ArgumentList @($domainG,"FullControl","Allow")
$acl.SetAccessRule($rule)
$acl |Set-Acl
$acl = Get-Item $subsubsubsubfolder |Get-Acl
# This adds full control to the sub sub sub subfolder
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule -ArgumentList @($domainG,"FullControl","Allow")
$acl.SetAccessRule($rule)
$acl |Set-Acl

The constructor you are using for the FileSystemAccessRule will only apply to the object the ACE belongs to. To have it apply to anything else, you'll have to use the constructor with the following arguments:
<Principal>, <Rights>, <InheritanceFlags>, <PropagationFlags>, <Type>
The one you're using doesn't have the flags. Those two flags enumerations control two things that you'll see in the GUI: 'Applies To' and 'Only Applies to this Object'. To have the ACE apply to the folder, subfolders and files (and have it not show as 'Special'
in the GUI), you'll want the InheritanceFlags as 'ContainerInherit, ObjectInherit' and the PropagationFlags as 'None'. Try this:
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule -ArgumentList @($domainG,"FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")
On a side note, check
this module out. It greatly simplifies access control. If you're interested in it and have any questions, let me know.

Similar Messages

  • Working with Folders and Sub-Folders

    I'm updating this big site, and its pages are organized into
    folders. I've only ever organized my images and .pdf files with
    folders not my html files but all my prior sites have never had so
    many files as this one. It’s starting to drive me crazy
    though because pages in folders aren't connecting to scripts in the
    scripts folder, menus aren't working right because of it and I'm
    not sure what I can do to fix it.
    My question is if images are showing up in these sub-pages,
    the linked css is being applied in these sub-pages why are the
    scripts not working in the sub-pages? For example, all the top
    level pages easily connect to the rotating JavaScript banner, but
    as soon as you go into a sub-folder page the banner disappears. All
    these files are being updated via templates so any changes I'm
    doing is affecting all the pages the same. That’s why
    it’s confusing me why an image would connect the same but a
    script wouldn't. Don't they search for their links root down or
    does it search the folder its in down? How can you get templates to
    work under such conditions where files are both in the root and in
    folders and sub-folders?
    Site reference is:
    http://golfforkids.net/focus/index.html
    Please note that this is a temporary domain for testing. The
    top menu will pop up a window saying that it needs to be
    registered. They are, just not to that domain and I don't have
    access to the native domain. Sorry for the inconvenience!
    Thank you for any clarification!!!

    ''"Are you subscribed to those subfolders?
    File (Alt-F) - Subscribe"''
    Please see #2 in original post:
    ''"2) Trying to Subscribe to folders only shows Inbox, not sub-folders for Inbox."''
    Attached is an image illustrating this (this screenshot was taken after forcing Thunderbird to show Inbox folders as described in #3 of OP)
    {In OP I was unable to attach images}

  • I am struggling! Help! I need to move 3500 pics-in TIFF format in 175 folders and sub folders from my old PSE6, Windows XP to my new PSE13, Windows8.1. I have the PSE6 backed up on an external hard drive. What is the safe way to do this? Can anyone at Ado

    I am struggling! Help! I need to move 3500 pics-in TIFF format in 175 folders and sub folders from my old PSE6, Windows XP to my new PSE13, Windows8.1. I have the PSE6 backed up on an external hard drive. What is the safe way to do this? Can anyone at Adobe help me? Please?

    Use the Organizer backup & restore method, starting the restore from the TLY file. Probably best to use a custom location as the XP file structure will be different. See this link for further help:
    http://helpx.adobe.com/photoshop-elements/kb/backup-restore-move-catalog-photoshop.html

  • Importing existing folders and sub folders of photos into photoshop organiser 9

    I have over 10,000 photos nicely organised in folders and sub folders in Bridge CS3 and want to migrate over to photoshop elements and use their organiser so I have everything in one place. However, when I try to import the photos, it brings them in as individual photos and not in their folders. It seems like I need to recreate a load of albums and then drag and drop the photos into them. I don't have time to recreate hundreds of album names to replicate my system as it is. Is there any way round this or should I be looking at a different system altogether?
    Thank you for any advice on this.

    ... should I be looking at a different system altogether?
    If your entire organizational goals are to continue to use your "nicely organised" folders, then why bother with the PSE Organizer in the first place? You have extra work (must import the photos) and more limitations (must do all photo management inside of the PSE Organizer), and its hard to see any benefit from using the PSE Organizer. You won't achieve any "better organization" than what you have now.
    If your goals are to use PSE tools to organize (tags, captions notes), in addition to (or as a replacement for) your folder organization, then the PSE Organizer can be very useful.

  • Can I arrange my bookmarks so that the folders and sub-folders are at the top of the list like in Explorer?

    I transferred all of my "Favorites" from Explorer. I have a lot of folders and sub-folders and I would like these to be listed at the top (as in Explorer) with individual bookmarks below. Right now the folders and individual bookmarks are mixed together.

    http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox
    If you '''Sort by Name''' in the Bookmarks Sidebar, that is how Firefox sorts bookmarks. If you have any '''''Separators''''', the Sort will stop there and you'll have to Sort from there down separately.

  • How To Add Folders and Sub Folders

    I am brand new (1 week) to my new Mac (iMac). In my Windows-based PC I used to have, for example, a folder named PHOTOS followed by sub folders designating certain categories that work for me, such as, "Family", "Vacations" etc, and I would make sure that all my uploads from my camers went to the appropriate folder.
    I would like to accomplish the same thing in my Mac, but have no idea how to go about it. I do not even know how to create such folders and sub folders.
    Is someone out there who can help, please?

    pstoll
    In the Finder: File -> New Folder creates a new Folder. To nest a folder inside another one then simply drag the second one to the first.
    But if you're trying to organise your photos, there's a much better way to do that on your Mac. Check out iPhoto It's a photo manager that's integrated throughout the Operating System. It's much, much more flexible than a bunch of folders in the Finder. You can keyword your pics, populate Smart Albums automatically, rate and edit your pics, all via iPhoto.
    You can find out more here:
    http://www.apple.com/ilife/iphoto/
    there are some tutorials here
    http://www.apple.com/ilife/tutorials/#iphoto
    and a good forum here:
    http://discussions.apple.com/category.jspa?categoryID=143
    My best advice is to explore the app by dragging in maybe 100 pics and testing things out, gettting the hang of it. It's miles better than a folder hierarchy.
    Regards
    TD

  • Unlocking All Folders and Sub Folders When Sharing

    Is there a way to share files and unlock them automatically. I Have many hundreads of excel and word docs in folders and sub folders.
    After a day scratching my head trying to work out why I could not save them on the shared computer I realized that I needed to unlock the folder.
    Excel does not have in its preferences anything that suggest this....it gets old real quick opening each file and then typing my computer password for each folder/ file etc....truly hope this can be done.
    Thanks in advance!

    Anyone???

  • HT201250 When restoring Time Machine after a failure, does it also restore the files to the same order, for example - within iPhoto I have pics/ videos in folders and sub folders organised as family/events etc - will it go back to this exact order after a

    When restoring Time Machine after a failure, does it also restore the files to the same order, for example - within iPhoto I have pics/ videos in folders and sub folders organised as family/events etc - will it go back to this exact order after a restore?

    Hi Stavros0203,
    When restoring your entire system from a Time Machine backup, it is restored to the state it was when that backup was made. See this article for reference -
    OS X Yosemite: Recover your entire system
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • How to create folders and sub folders in numbers on my mac book pro?, how to create folders and sub folders in numbers on my mac book pro?

    I am new to Mac and numbers how do I create folders and sub folders on my mac book pro ? I have created folders on my ipad3 but I cant seem to make a sub folder ?
    Can any one help ?
    Thanks in advance!

    To create a folder either select New Folder from the Finder's File menu or the keyboard equivalend command-shift-N.  Select that folder and do the same. Viola!  You have a folder inside a folder.

  • Unable to grant full access permission

    I am trying to grant full access permissions for one user to another users mailbox  when I right click on the user the command does not appear to allow this.  I have tried using the Add-MailboxPermission CMdlet but this is not recognised either.
    My exchange knowledge is relatively limited so it may be something simple, but I would appreciate any assistance.
    best regards
    James

    Turns out someone had saved the wrong credentials in the RDP  connection and I was logging in as the wrong user.

  • How to create a folders and sub folders in solution manager ?

    Hi gurus,
    i want  2 know how to create folders and subfolders inside solution manager under configuration structure or business blue print  structure.
    tell me in detailed
    Thank you Regards
    sasikanth

    Hi kishore,
    Thanks for ur reply.
    wht u told is about to insert the file(.doc,.ppt..zip) in a particular folder name(FI folder or SD folder  under business scenarios folder which is main folder).
    here business scenarios is one main folder and FI and SD folders are sub folders  under business scenarios folder.
    I want to know how to create the these folders  and not the file insertion.
    Thank you and Regards
    sasikanth.

  • Merging Folders and Sub Folders.

    this might be a stupid question.
    let me just say i like backing up my music in folders on a drive that are more easily accessed than on time machine.  and for many years ive had all my music backed up on 2 different backup drives. ive always just picked out everything that was new within the sub folders and moved them over.
    is there a way to automatically merge all folders, subfolders, and files without re-copying everything??
    for example. let me set this up. i have one folder on the Root drive Called "Music" the directory goes "Music/Artist/Album/Songs" etc.
    if i want to copy all the new music without copying every single artist and album again by hitting replace, i have to go in and manually select new albums from existing artist folders and drop them in.
    if that doesnt make sense... lets say i have an artist already in my library and i add a new album. it shows up in my itunes artist folder in another folder. but if i go into finder and select all artists and drag them into the backup disk "music" folder and it says.. "this folder already exitsts" Skip, Replace, Stop. or whatever. if i hit skip it will completly skip the new albums from existing artist folders and only add new artists from the "Music" Folder.
    if there a way i can make it Merge and add every folder and file from new albums instead of skipping over them???

    The only stupid question is one that you don't ask (my favourite saying from when I was an instructor)
    Think of what you are trying to do more as adding to or removing from or changing a group of source files and folders and you want that structure "mirrored" to another drive. The rsync command is ideal for this; it compares the source and destination structures and makes the destination match the source by adding items to the destination if they aren't there, removing items from the destination if they are no longer on the source destination. In doing the comparison, it builds a list of what needs changing, so that only those things get copied, not everything.
    it will work most conveniently for you if you make it copy your iTunes media folder, because then you only need to add your new album (for example) into iTunes and then use rsync twice, once for each backup drive. As an iTunes media folder is usually organised how you describe (artist/album/song), so you don't need to maintain your own separate structure, you'll simply have two extra copies of your iTunes media folder, one on each backup drive... Sound like what you want?
    The downside to rsync for beginners is it's usage from the Terminal; it can be daunting, and for those new to the command line, the help can be cryptic sometimes. It's past midnight here and I need to crash, so if you want I can help you with it in 12 hours or so, just reply to let me know. In the meantime, if you want to use rsync, open Terminal (Applications > Utilities) and type man rsync. You can read up on it a bit; don't worry if you don't understand a lot of it at the moment, the purpose is to understand better the command we will be putting together when you finally see it. When reading man pages, hit F to go forward a page, B to go back and Q to quit.

  • Folders and Sub Folders

    Hi,
    Could someone tell me if there is an easy way to open all the sub folders inside a folder?
    For example I'm sorting out my iTunes folder the itunes music folder has about 70 folders inside it and each one of them has other folders inside, I spend quite some time to open all of them and I just wondered if there was a shortcut?
    Kind Regards
    Adrian Vogel

    I don't know of a special command to +open all+, but you can select multiple folders in a Finder window, and issue the regular Open command from the File menu, or hit Command-O, or double-click on one of the selected folders. All the selected (highlighted) folder should open.
    You can select multiple items in a row using the click first - press Shift key - click last method.
    You can select multiple items NOT in a row by pressing Option and Command keys while clicking to select.
    Also, instead of opening a large number of windows, I find the +column view+ in a Finder windows to be useful.

  • Exchange email folders and sub-folders: iPhone only pulling main "inbox"

    Hello.
    I've got iPhone set to access my Exchange email via IMAP. My work computer is an Win XP PRo, running Outlook 2007. My Outlook email folders are organized via rules that most important emails are automatically routed to specific folders (such as from a particular client or staff member).
    My problem is The iPhone is only checking for mail in my main inbox. The only way I can get it to check for mail in my sub-folders is to click on the folder. This is a big problem, as I am missing notifications, and have over 35 subfolders!
    I've tried and tried to find a setting I can change, or something...but cannot. Does anyone have any recommendations either via iPhone settings or my Outlook rules settings?
    Thanks so much in advance!
    Sovi

    Thanks for posting that thread. My problem is slightly different in that it won't pull the mail *at all* -- even to the inbox. The mail is only pulled if/when I click on the sub-folder. At that point, the mail goes go to the correct sub-folder.
    For obvious reasons this is an issue -- I miss lots of mail!
    I (we) can't be the only ones using sub-folders with this issue.

  • I can´t use folders and sub folders in the screensaver now, whay´s that?

    My problem is that since I install OS X Moutain Lion I only can choose one folder and doesn´t give me the option to mark olso sub folders. would you please tell me why you take that option that was so great to use?
    thank you

    Because Apple doesn't want you to have choices. They also remove many previously installed ones, apparently because they would work well with their retina displays. I restored those. File a bug report with Apple for lost functionality.

Maybe you are looking for

  • How to create new nav buttons in nav bar

    I am trying to design a new site in iWeb. I want to add a row of navigation buttons to go to 8 different pages. All I have in the first page is a button called "welcome" and I cannot add anymore. It won't even let me select rollover colors or anythin

  • Firefox displaying page in portrait instead of landscape

    I have a problem with web pages created using Microsoft Reporting Services to display query results. I'm not the developer for these pages, but I am a software developer so technical replies are welcome. Pages that display correctly in IE 7 (and earl

  • How to refer the class package "com.sapportals.connector" for MDM API?

    Hi, Iam trying to execute one example mdm api program in dynpro/ejb. I could not refer the class package com.sapportals.connector. What SCA or build path package needed for dev time and runtime and where do i get that. Please help me. Thanks Hari

  • Cisco Prime Infrastructure 2.2 Rest API XML does not add LF

    I am using several scripts that dig the data from XML files created through Cisco Prime Infrastructure Rest API. It worked fine until 2.1. Now, with 2.2, seems Cisco stopped adding LF to each line and everything is 'one' line. Here is an example with

  • Execute-asynchronous

    Hi All,   When I created the inbound proxy these are the objects generated. <b>Type       Name                Shorttext</b> Interface  ZJSII_IN_JS_MI      Proxy Interface Structure  ZJSSRC_DT           Proxy Structure Structure  ZJSSRC_DT_HEADER    P