

$keyPath = 'HKLM:\SOFTWARE\WOW6432Node\AnalyseMe\TicketDBConnections\GobalGaming'

if (-not (Test-Path $keyPath)) {
    Write-Error "Registry key not found: $keyPath"
    exit 1
}


$acl = Get-Acl -Path $keyPath

$identities = @(
    'APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES',
    'BUILTIN\Users'
)

foreach ($identity in $identities) {
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule(
        $identity,
        [System.Security.AccessControl.RegistryRights]::FullControl,
        [System.Security.AccessControl.InheritanceFlags]'ContainerInherit',
        [System.Security.AccessControl.PropagationFlags]::None,
        [System.Security.AccessControl.AccessControlType]::Allow
    )
    $acl.AddAccessRule($rule)
    Write-Host "Added Full Control (Allow) for $identity"
}

Set-Acl -Path $keyPath -AclObject $acl

Write-Host "`nPermissions updated successfully on $keyPath" 
Write-Host "Current ACL:"
(Get-Acl -Path $keyPath).Access | Format-Table IdentityReference, RegistryRights, AccessControlType -AutoSize
