Posted On February 16, 2022

PowerShell: Grant Current User Full Access to File or Folder

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Grant Current User Full Access to File or Folder
# Grant Current User Full Access to Object
$object='C:\temp'
$acl=Get-Acl $object
$currentUser=[System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$grantAccess=New-Object System.Security.AccessControl.FileSystemAccessRule("$currentUser","FullControl","Allow")
$acl.AddAccessRule($grantAccess)
Set-Acl $object $acl

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Adding a Domain Security Group into the Hyper-V Administrator Users Group

Issue: Resolution: Click Start > Control Panel > Administration Tools > Computer Management > System Tools…

Linux: Enable PowerShell Remoting WinRM Client on Ubuntu 20.04

This note is a work-in-progress as the NTLM authentication support module by Microsoft for Ubuntu…

How to Call Functions or Pass Function as Argument

cls   function listClusters{     # List all Clusters in this Domain     $items=get-cluster -domain (get-addomain)     $global:clusters=$items…