Add Take Ownership to Context Menu in Windows 10  

Page 39 of 64 FirstFirst ... 29373839404149 ... LastLast

  1. Posts : 68,836
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #380

    mike406 said:
    Hello, I'm a software engineer and use take ownership quite often in my line of work and noticed a slight quirk/issue with the way you have the ICACLS command set up. When I use your Take Ownership from the context menu, while it recursively does takeown properly, it only applies the ICACLS command to the root folder and not for subdirectories. So what happens is even after Take Ownership is ran, the user can still encounter this popup on sub-directories:
    https://i.gyazo.com/a8d0910adaca75b6...7cd9920557.png

    The issue is that the OWNER RIGHTS group doesn't get added to subdirectories. This is because the /t flag is missing from ICACLS and should be added to your registry file for this to work properly. I'm not sure if it worked without the /t flag on older versions of Windows but this is how it needs to be done on Windows 10 at least to mitigate that popup. While omitting the /t flag doesn't hinder the user from entering the folder as they can click Continue on the popup, it becomes annoying when dealing with deeply rooted subdirectories.

    Screenshot of a sub-directory's permissions after your Take Ownership is run from the root: https://i.gyazo.com/7637a10a85f01867...0873ad5eca.png

    Screenshot of the same sub-directory after I added the /t flag to ICACLS: https://i.gyazo.com/dead81d6a585e9d4...ab6a772f89.png

    Hope you will take this into consideration.


    Thank you @mike406, and welcome to Ten Forums. :)

    I have updated the tutorial to have the /t flag included for the ICACLS commands now.
      My Computers


  2. Posts : 9
    Windows 10
       #381

    Brink said:
    Thank you @mike406, and welcome to Ten Forums. :)

    I have updated the tutorial to have the /t flag included for the ICACLS commands now.
    Awesome! Appreciate the quick response and thank you for the welcome.
      My Computer


  3. Posts : 56,823
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #382

    @Brink

    Shawn, thanks for the update to this tutorial.

    Question.... The version of "Take Ownership" I have installed is very old (Apr 2014) and the .reg is named "InstallTakeOwnership".

    Code:
    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"
    The new version here is called "Add_Take_Ownership_to_context_menu" and is quite different, using Powershell instead of CMD and is much more extensive than just the /t switch addition.

    Code:
    Windows Registry Editor Version 5.00
    
    ; Created by: Shawn Brink
    ; Created on: January 28th 2015
    ; Updated on: February 16th 2018
    ; Tutorial: https://www.tenforums.com/tutorials/3841-add-take-ownership-context-menu-windows-10-a.html
    
    
    
    [HKEY_CLASSES_ROOT\*\shell\TakeOwnership]
    @="Take Ownership"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "Position"="middle"
    
    [HKEY_CLASSES_ROOT\*\shell\TakeOwnership\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l' -Verb runAs\""
    "IsolatedCommand"= "powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l' -Verb runAs\""
    
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership]
    @="Take Ownership"
    "AppliesTo"="NOT (System.ItemPathDisplay:=\"C:\\Users\" OR System.ItemPathDisplay:=\"C:\\ProgramData\" OR System.ItemPathDisplay:=\"C:\\Windows\" OR System.ItemPathDisplay:=\"C:\\Windows\\System32\" OR System.ItemPathDisplay:=\"C:\\Program Files\" OR System.ItemPathDisplay:=\"C:\\Program Files (x86)\")"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "Position"="middle"
    
    [HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" /r /d y && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l /q' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" /r /d y && icacls \\\"%1\\\" /grant *S-1-3-4:F /t /c /l /q' -Verb runAs\""
    My question is, is it necessary (or wise) to run the "Remove_Take_Ownership_from_context_menu" .reg before merging the new one?

    Code:
    Windows Registry Editor Version 5.00
    
    ; Created by: Shawn Brink
    ; Created on: January 28th 2015
    ; Updated on: June 18th 2017
    ; Tutorial: https://www.tenforums.com/tutorials/3841-add-take-ownership-context-menu-windows-10-a.html
    
    
    ; To remove old Take Ownership context menu
    [-HKEY_CLASSES_ROOT\*\shell\runas]
    
    [-HKEY_CLASSES_ROOT\Directory\shell\runas]
    
    [-HKEY_CLASSES_ROOT\dllfile\shell\runas]
    
    
    ; To remove newer current Take Ownership context menu
    [-HKEY_CLASSES_ROOT\*\shell\TakeOwnership]
    [-HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership]
    Thanks, TC.
      My Computers


  4. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
       #383

    f14tomcat said:
    ...My question is, is it necessary (or wise) to run the "Remove_Take_Ownership_from_context_menu" .reg before merging the new one?

    Thanks, TC.
    Good question. I didn't give it any thought and just ran the new version. Seems to work without any issues though.
      My Computer


  5. Posts : 56,823
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #384

    CWGilley said:
    Good question. I didn't give it any thought and just ran the new version. Seems to work without any issues though.
    Thanks, Clayton. Just being digitally paranoid, I guess!
      My Computers


  6. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
       #385

    f14tomcat said:
    Thanks, Clayton. Just being digitally paranoid, I guess!
    I AM NOT paranoid! Why are you people all against me?
      My Computer


  7. Posts : 56,823
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #386

    CWGilley said:
    I AM NOT paranoid! Why are you people all against me?
    Me, Clayton, me! Not you! :)
      My Computers


  8. Posts : 68,836
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #387

    Hello Guys, :)

    Yeah, you would want to run the old remove .reg file for the old version since it's under the "runas" key, and the new one isn't.
      My Computers


  9. Posts : 1,097
    Windows 10 Home x64 Version 1809 (OS Build 17763.437)
       #388

    OK, I just ran the new Remove and then the new Add after which the thought occurred, should I have ran the OLD Remove?
      My Computer


  10. Posts : 68,836
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #389

    That's fine. The new.remove will still remove the old version.
      My Computers


 

Tutorial Categories

Add Take Ownership to Context Menu in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:37.
Find Us




Windows 10 Forums