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

Ubuntu/Lubuntu: Setting Up Development Environment

Linux is a great platform for development. One advantage of a this OS is that…

Python: Package Installer for Python (PIP)

This comes preinstalled with Python 3.4 or higher. Similar to the Microsoft PowerShell Gallery, Python.org…

How to Search for Installed Application by Name in PowerShell

One can search using the known Vendor or application Name as illustrated below: [testwindows]: PS…