There is a registry key on Win Server 2008 R2,
HKCR:\CLSID\{76A64158-CB41-11D1-8B02-00600806D9B6}
whose owner is not Administrator. It is TrustedInstaller. Now to make Remote DCOM/WMI connection working, I need to give Administrator the permission to have Full Control over this key and ownership as well. As this needs to be done on several machines, I was hoping I could do this using Powershell. I followed these
Controlling Registry ACL Permissions with Powershell
Change the owner of directories with powershell
but I still get this error
Exception calling "OpenSubKey" with "3" argument(s): "Requested registry access is not allowed."
The code I am trying to run is simple
$key = [Microsoft.Win32.Registry]::ClassesRoot.OpenSubKey(
"CLSID\{76A64158-CB41-11D1-8B02-00600806D9B6}",
[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,
[System.Security.AccessControl.RegistryRights]::TakeOwnership
)
echo $key
Any ideas on how to change ownership of this key? I believe once the ownership is changed to Administrator, I will be able to change permissions using Set-Acl.
I was able to achieve this in powershell using the following script
I ran into similar problem previously. Instead of trying to take ownership of the key, I changed the permission of it so that it can be readable to everyone (8). This can be done using 'regini'. I have a wrapper function that can change the permission of the provided key.
Example: RegistryPermission -server 'localhost' -key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum" -string '[1 8 17]'
For more info, run 'regini' in command prompt for the permission settings.