Windows 10: Add Take Ownership to Context Menu in Windows 10  

Page 39 of 45 FirstFirst ... 293738394041 ... LastLast
  1. Brink's Avatar
    Posts : 33,086
    64-bit Windows 10 Pro build 18262
    Thread Starter
       16 Feb 2018 #380

    mike406 said: View Post
    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 ComputersSystem Spec

  2.    16 Feb 2018 #381

    Brink said: View Post
    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 ComputerSystem Spec

  3. f14tomcat's Avatar
    Posts : 37,041
    Triple boot - Win 10 Pro, Win 10 Pro Insider (2) - (and a sprinkling of VMs)
       17 Feb 2018 #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 ComputersSystem Spec

  4. Wiley Coyote's Avatar
    Posts : 900
    Windows 10 Home x64 Version 1809 (OS Build 17763.55)
       17 Feb 2018 #383

    f14tomcat said: View Post
    ...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 ComputersSystem Spec

  5. f14tomcat's Avatar
    Posts : 37,041
    Triple boot - Win 10 Pro, Win 10 Pro Insider (2) - (and a sprinkling of VMs)
       17 Feb 2018 #384

    CWGilley said: View Post
    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 ComputersSystem Spec

  6. Wiley Coyote's Avatar
    Posts : 900
    Windows 10 Home x64 Version 1809 (OS Build 17763.55)
       17 Feb 2018 #385

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

  7. f14tomcat's Avatar
    Posts : 37,041
    Triple boot - Win 10 Pro, Win 10 Pro Insider (2) - (and a sprinkling of VMs)
       17 Feb 2018 #386

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

  8. Brink's Avatar
    Posts : 33,086
    64-bit Windows 10 Pro build 18262
    Thread Starter
       17 Feb 2018 #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 ComputersSystem Spec

  9. Wiley Coyote's Avatar
    Posts : 900
    Windows 10 Home x64 Version 1809 (OS Build 17763.55)
       17 Feb 2018 #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 ComputersSystem Spec

  10. Brink's Avatar
    Posts : 33,086
    64-bit Windows 10 Pro build 18262
    Thread Starter
       17 Feb 2018 #389

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


 
Page 39 of 45 FirstFirst ... 293738394041 ... LastLast

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 Xbox Windows Phone


Related Threads
How to Add or Remove the New context menu in Windows 10 The New context menu allows users to quickly create new files, folders, or shortcuts in the current location. You can right click or press and hold on your desktop or in any folder window,...
How to Add Windows Batch File to New Context Menu in Windows 10 A .bat file is a batch file that consists of a series of commands to be executed by the command line interpreter, stored in a plain text file. The New context menu allows users...
System protection (if turned on) is a feature that allows you to perform a system restore that takes your PC back to an earlier point in time, called a system restore point. This can be handy if your PC isn't working well and you recently installed...
A .vbs file is a VBScript (Visual Basic Script) file written in the VBScript scripting language that can be executed within Windows or Internet Explorer via the Windows-based script host (Wscript.exe), and may also use the .vb file extension. The...
How to Add or Remove Open with Context Menu to BAT files in Windows 10 A .bat file is a batch file that consists of a series of commands to be executed by the command line interpreter, stored in a plain text file. The Open with context menu...

Tags for this Thread

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 00:30.
Find Us