© 2017 Altair d.o.o. Slovenia

  • Facebook - White Circle
  • LinkedIn - White Circle
  • Google+ - White Circle

How to add NTFS access to several folders (with the inheritance disabled) using PowerShell

September 28, 2018

In this example, we add full access (for an account or group) to all user profiles in the C:\Users folder.

 

Get-ChildItem -Directory -Path C:\Users | ForEach-Object {
$acl = Get-ACL -Path $_.FullName;
$rule = new-object System.Security.AccessControl.FileSystemAccessRule "ComputerName\LocalAccountOrGroup","FullControl","ContainerInherit,ObjectInherit","None","Allow";
$acl.AddAccessRule($rule);
Set-Acl -Path $_.FullName -AclObject $acl;}

Share on Facebook
Please reload

Povezane
Please reload