What is the syntax to use "takeown.exe" on a registry key?

3

1

Simple question, but how do you do it?

I've tried:

takeown /f //HKEY_LOCAL_MACHINE/MyKey/ \R \A

As expected, this fails to find anything because it looks like a network address.

Any ideas? It's part of my investigation into this question.

Josh Comley

Posted 2009-11-21T15:10:32.360

Reputation: 3 582

Answers

3

I believe takeown.exe for taking ownership of a file, not for Registry keys.

C:\Users\Sathya>takeown /?

TAKEOWN [/S system [/U username [/P [password]]]]
        /F filename [/A] [/R [/D prompt]]

Description: This tool allows an administrator to recover access to a file that was denied by re-assigning file ownership.

By executing

takeown /f //HKEY_LOCAL_MACHINE/MyKey/ \R \A

You're saying take ownership of file located at network location HKEY_LOCAL_MACHINE with share name of MyKey, which is not the way registry keys are stored.

Also, \R and \A should be specified with forward slashes, not backslashes, ie, /R /A


To take ownership of registry key,

Open Registry Editor.

Click the key you want to take ownership of.

On the Edit menu, click Permissions.

Click Advanced, and then click the Owner tab.

Under Change owner to, click the new owner, and then click OK.

To do so via an external program you'll need an App like RegDACL

What is RegDACL good for? RegDACL allows you to query and change the discretionary access control list (DACL) of any Windows NT Registry key. You can of course use the program RegEdt32 to set registry permissions, but if you need to edit more than a few machines then you are faced with quite a boring job, not to mention being more prone to make mistakes. RegDACL gives you the ability to use a batch script to perform this job. The freeware versions of RegDACL allow you to define access permissions for the predefined groups

Sathyajith Bhat

Posted 2009-11-21T15:10:32.360

Reputation: 58 436

Thanks for summing it all up nicely - I had already ended up using RegDACL to answer my own other question, great tool. Doing it from Regedit didn't work! – Josh Comley – 2009-11-22T15:40:31.280

Ah, glad to know you've gotten your problem solved. – Sathyajith Bhat – 2009-11-22T15:50:03.367

0

As mentioned in above answer as takeown does not work.

Instead of changing permissions there is a simple program that can run a .reg file, batch file, cmd, powershell or program as TrustedInstaller for example.

PowerRun is a portable freeware to launch regedit.exe , Cmd.exe or other software with the same privileges as the TrustedInstaller / Nt Authority/ System Why would you need it? Sometimes it is just not enough to just be running as Administrator, Maybe it’s a file or a registry key that is locked or not editable, PowerRun a tool with this powerfull privilege most likely solve that , PowerRun doesn’t require any installation process or additional dll files.

Sordum PowerRun Website

PowerRun Download


Or one could use psexec from Microsoft and run as System, either powershell.exe or cmd.exe.

psexec64 -i -s cmd.exe
psexec64 -i -s powershell.exe

Then run registry commands in console.

Under A Tree

Posted 2009-11-21T15:10:32.360

Reputation: 849