在 Windows Server 2008 R2 上将 HKCR\CLSID\* 密钥的所有者更改为管理员
Win Server 2008 R2 上有一个注册表项,
HKCR:\CLSID\{76A64158-CB41-11D1-8B02-00600806D9B6}
其所有者不是管理员。它是TrustedInstaller。现在制作远程 DCOM/WMI 连接正常,我需要授予管理员权限 也完全控制该密钥和所有权。由于这需要在 几台机器,我希望我可以使用 Powershell 来完成此操作。我跟着 这些
但我仍然出现此错误
Exception calling "OpenSubKey" with "3" argument(s): "Requested registry access is not allowed."
我尝试运行的代码很简单
$key = [Microsoft.Win32.Registry]::ClassesRoot.OpenSubKey(
"CLSID\{76A64158-CB41-11D1-8B02-00600806D9B6}",
[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,
[System.Security.AccessControl.RegistryRights]::TakeOwnership
)
echo $key
关于如何更改此密钥的所有权有什么想法吗?我相信一旦拥有 更改为管理员后,我将能够使用 Set-Acl 更改权限。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能够使用以下脚本在 powershell 中实现此目的
I was able to achieve this in powershell using the following script
我以前遇到过类似的问题。我没有尝试获取密钥的所有权,而是更改了它的权限,以便每个人都可以读取它 (8)。这可以使用“regini”来完成。我有一个包装函数,可以更改提供的密钥的权限。
示例:RegistryPermission -server 'localhost' -key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum" -string '[1 8 17]'
有关详细信息,请在命令提示符下运行“regini”进行权限设置。
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.