Windows 10 permission archive in powershell

Solution
Something like this would give a user full access. You'd just need to change the Get-ACL and Set-ACL lines to the directory or file you want to change permissions on. and change computername\user to the user you want to grant the access for.

Code:
$ACL = Get-ACL .\Temp\
$Rule = [System.Security.AccessControl.FileSystemAccessRule]::new(@"computername\user",[System.Security.AccessControl.FileSystemRights]::FullControl,[System.Security.AccessControl.AccessControlType]::Allow)
$ACL.Access.AddRule($Rule)
Set-Acl -Path .\Temp\ -AclObject $ACL
Something like this would give a user full access. You'd just need to change the Get-ACL and Set-ACL lines to the directory or file you want to change permissions on. and change computername\user to the user you want to grant the access for.

Code:
$ACL = Get-ACL .\Temp\
$Rule = [System.Security.AccessControl.FileSystemAccessRule]::new(@"computername\user",[System.Security.AccessControl.FileSystemRights]::FullControl,[System.Security.AccessControl.AccessControlType]::Allow)
$ACL.Access.AddRule($Rule)
Set-Acl -Path .\Temp\ -AclObject $ACL
 

Solution
Back
Top