Take ownership of files and folders

Hi guys,

On Jeff Wouters’s blog I saw this script and it is very usefull.

All credits go to Jeff and here’s the info.

One of my favorite registry tweaks which enables me to take ownership of folders and/or files very quickly, for example a bunch of profile directories from users when I need to delete them.
The following registry keys will add an option to the right-click menu named “Take Ownership”.
When using this option, you only need to click on “Take Ownership” and you’re done!
No more clicking to the point where you can find your username to take ownership, just do it like this… and trust me when I say that this will save you a lot of time.

[HKEY_CLASSES_ROOT*shellrunas]
@=”Take Ownership”
“NoWorkingDirectory”=””

[HKEY_CLASSES_ROOT*shellrunascommand]
@=”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_ROOTDirectoryshellrunas]
@=”Take Ownership”
“NoWorkingDirectory”=””

[HKEY_CLASSES_ROOTDirectoryshellrunascommand]
@=”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”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.