Answered by:
Add "Full Control" to a Folder

Question
-
I'm trying to add the "everyone" group to a folder (c:\test) and give to "Full Control".
What Powershell command would do this?
Also, I would like the NTFS permissions to be inherited by this folder (meaning: subfolders & files).
I have looked all over the INTERNET, but I'm just not seeing the right answer.
This seems like it would be a simple thing to do.
Thanks,
Monday, December 18, 2017 2:22 AM
Answers
-
You might want to try the icacls DOS command:
icacls "\\Server1\C$\Test" /grant Everyone:(OI)(CI)F /T
OI = Object Inherit - This flag indicates that subordinate files will inherit
CI = Container Inherit - This flag indicates that subordinate containers will inherit
F = Full Control
/T = Apply recursively to existing files and sub-folders. (OI and CI only apply to new files and sub-folders)This is great and it does work, but I was wanting to do it in Powershell only because this is the direction that Microsoft is heading.
Thanks
- Marked as answer by finsfree11 Friday, December 29, 2017 8:51 PM
Monday, December 18, 2017 3:54 PM
All replies
-
Help set-acl -online
\_(ツ)_/
Monday, December 18, 2017 3:12 AM -
You might want to try the icacls DOS command:
icacls "\\Server1\C$\Test" /grant Everyone:(OI)(CI)F /T
OI = Object Inherit - This flag indicates that subordinate files will inherit
CI = Container Inherit - This flag indicates that subordinate containers will inherit
F = Full Control
/T = Apply recursively to existing files and sub-folders. (OI and CI only apply to new files and sub-folders)Monday, December 18, 2017 6:44 AM -
You might want to try the icacls DOS command:
icacls "\\Server1\C$\Test" /grant Everyone:(OI)(CI)F /T
OI = Object Inherit - This flag indicates that subordinate files will inherit
CI = Container Inherit - This flag indicates that subordinate containers will inherit
F = Full Control
/T = Apply recursively to existing files and sub-folders. (OI and CI only apply to new files and sub-folders)This is great and it does work, but I was wanting to do it in Powershell only because this is the direction that Microsoft is heading.
Thanks
- Marked as answer by finsfree11 Friday, December 29, 2017 8:51 PM
Monday, December 18, 2017 3:54 PM -
Hi,
Based on my research, you may have a try with the following script. Hope it is helpful to you:
$path = 'C:\Test' $acl = Get-Acl -Path $path $accessrule = New-Object System.Security.AccessControl.FileSystemAccessRule ('Everyone', 'FullControl', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow') $acl.SetAccessRule($accessrule) Set-Acl -Path $path -AclObject $acl
For more information, please refer to the following article:
FileSystemAccessRule Class
https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemaccessrule(v=vs.110).aspx
If you need further help, please feel free to let us know.
Best Regards,
Albert
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- Edited by Albert LingMicrosoft contingent staff Tuesday, December 19, 2017 6:33 AM
- Proposed as answer by Albert LingMicrosoft contingent staff Monday, December 25, 2017 12:08 PM
Tuesday, December 19, 2017 6:31 AM -
This worked for me:
$Acl = Get-Acl "\\Server1\C$\Test"
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl.SetAccessRule($Ar)
Set-Acl "\\Server1\C$\Test" $AclWednesday, December 20, 2017 12:22 AM -
Hi,
Just checking in to see if the information provided was helpful. Does the script work?
Please let us know if you would like further assistance.
Best Regards,
AlbertPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.comThursday, December 21, 2017 7:45 AM -
Hi,
I am checking how the issue is going, if you still have any questions, please feel free to contact us.
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Appreciate for your feedback.
Best Regards,
AlbertPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.comMonday, December 25, 2017 12:08 PM -
Thanks, I think I'll stick with command prompt (icacls).Friday, December 29, 2017 8:50 PM
-
This is great and it does work, but I was wanting to do it in Powershell only because this is the direction that Microsoft is heading.
Thanks
\_(ツ)_/
Friday, December 29, 2017 9:00 PM -
This Worked for me.Friday, July 19, 2019 3:08 PM
-
Funny how icacls /save makes a unicode file with no bom.
Friday, July 19, 2019 6:24 PM