Friday 1 June 2012

Taking ownership of Windows files

Registry 'hack' for taking ownership of Windows files. A simpler work-around for the usually cumbersome series of steps you normally otherwise have to take to achieve the same results: Copy and paste the following script into notepad and save the file with a .reg extension. (for example, TakeOwnership.reg) You will then be able to double-click on the file and have the registry auto-updated with the necessary settings.

You'll most likely get a prompt asking "Adding information can unintentionally change or delete values...blah blah blah...etc, ...Are you sure you want to continue". Just click 'Yes' if you're sure you want the 'Take Ownership' feature installed.

This is the menu option (highlighted in yellow) that this registry update will add to your right-click context menu in Windows Explorer:


Copy Code below:

[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"

No comments:

Post a Comment