$path = "C:\test" $name = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name $acl = Get-Acl "C:\test" $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($name,"FullControl","Allow") $acl.SetAccessRule($accessRule) $acl | Set-Acl "C:\test" Get-ChildItem -Path "$path" -Recurse -Force | Set-Acl -aclObject $acl -Verbose