Modifying registry permissions is a common administrative task, particularly when configuring systems or applications that require elevated access. This script uses PowerShell to grant specific user permissions to a designated registry key.
PowerShell Script
The following script sets the owner of the specified registry key to the “Administrators” group and modifies the Access Control List (ACL) accordingly.
$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\UserSwitch"
$account = New-Object -TypeName System.Security.Principal.NTAccount -ArgumentList 'Administrateurs'
$acl = Get-Acl -Path $path
$acl.SetOwner($account)
Set-Acl -Path $path -AclObject $acl
0 Comments