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

Basic CSS: Override Styles in Subsequent CSS

<style>body {background-color: black;font-family: monospace;color: green;}.pink-text {color: pink;}</style><h1 class="pink-text">Hello World!</h1>

PowerShell: Reset Password for All Users inside an OU

$ouName="Funky Dudes" $ouPath = "ou=$ouName,dc=intranet,dc=baam,dc=com" $plaintextPassword='WHATPASSWORD?' $users=Get-ADUser -Filter * -SearchBase $ouPath | Select-object Name,UserPrincipalName,DistinguishedName foreach…

In Search of an Appointment Calendaring System

Group I: Wordpress Plug-in Since websites are often built with Content Management Systems such as…