Saturday, January 1, 2011

How to Add "Take Ownership" to Explorer Right-Click Menu in Win 7 or Vista

 

Taking ownership of system files or folders in Windows 7 or Vista is not a simple task. Whether you use the GUI or the command line, it takes far too many steps.

Thankfully somebody created a registry hack that will give you a menu item for “Take Ownership” that will handle all the steps for you.  (If you are the person that originally made this script, let me know and I’ll give you credit)

Here’s what the new right-click menu will look like after installing this registry hack.

image

1. Back up your registry.

2. Open notepad and copy paste the following: (matter between the lines)

-----------------------------------------------------------------------------------------------------------------------

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]

@="Take Ownership"

"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]

@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]

@="Take Ownership"

"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]

@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

------------------------------------------------------------------------------------------------------------------------------------------------------------------

3. Save it as InstallTakeOwnership.reg

4. Double-click the InstallTakeOwnership.reg file and click through the prompts. No reboot necessary.

image

Uninstall

5. Open Notepad and copy past the following (matter between the lines)

---------------------------------------------------------------------------------------------------------------------------

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\*\shell\runas]

[-HKEY_CLASSES_ROOT\Directory\shell\runas]

-----------------------------------------------------------------------------------------------------------------------

6. Save it as RemoveTakeOwnerwhip.reg

7. Double-click the RemoveTakeOwnership.reg file and click through the prompts. No reboot necessary.

Note :  Always backup your registry before doing anything with regedit.

No comments: