Add Take Ownership to Context Menu in Windows 10  


  1. Posts : 2
    windows 10
       #610

    Hello I got myself into a little trouble using this script, hopefully you can help, or at the very least some other poor fool(err I mean soul) will be spared.

    I was trying to create space on another persons drive so I grabbed their system drive and plugged it into my computer. They had about 50 gigs in C:\Users\UserName\AppData. I couldn't Access it so yes you guessed it "Take Ownership". I had to do this at the UserName level. It ran for like 4 minutes, which is a long time concerning file operations with this computer. This part of the operation was as expected, transferred the files.

    When I hooked it back up to the other computer, it said the disk needed to be repaired. I let it go through the operation, rebooted windows, made it to the desktop. First problem, right click on windows start was no longer functional. Second problem, Firefox wouldn't load their profile and could not make any connections citing SEC_ERROR_LIBRARY_FAILURE. They had a couple .png files on the desktop, on attempted viewing, software blamed incorrect permission and failed to load image. Ah yes and who could forget the dreaded com surrogate failures or the myriad AppModel-State Errors E.g.,Failure to load the application settings for package Microsoft.Windows.Photos_8wekyb3d8bbwe. Error Code: -2147024891.

    I had them run Take Ownership on the same path I did, this didn't fix the issue's. On the bright side, They could view those .png files by Taking Ownership.

    Any Help or Ideas would be highly appreciated.
      My Computer


  2. Posts : 68,994
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #611

    Warsong said:
    Hello I got myself into a little trouble using this script, hopefully you can help, or at the very least some other poor fool(err I mean soul) will be spared.

    I was trying to create space on another persons drive so I grabbed their system drive and plugged it into my computer. They had about 50 gigs in C:\Users\UserName\AppData. I couldn't Access it so yes you guessed it "Take Ownership". I had to do this at the UserName level. It ran for like 4 minutes, which is a long time concerning file operations with this computer. This part of the operation was as expected, transferred the files.

    When I hooked it back up to the other computer, it said the disk needed to be repaired. I let it go through the operation, rebooted windows, made it to the desktop. First problem, right click on windows start was no longer functional. Second problem, Firefox wouldn't load their profile and could not make any connections citing SEC_ERROR_LIBRARY_FAILURE. They had a couple .png files on the desktop, on attempted viewing, software blamed incorrect permission and failed to load image. Ah yes and who could forget the dreaded com surrogate failures or the myriad AppModel-State Errors E.g.,Failure to load the application settings for package Microsoft.Windows.Photos_8wekyb3d8bbwe. Error Code: -2147024891.

    I had them run Take Ownership on the same path I did, this didn't fix the issue's. On the bright side, They could view those .png files by Taking Ownership.

    Any Help or Ideas would be highly appreciated.
    Hello Warsong, and welcome.

    You could see if using "Reset Permissions" below may restore the default permissions of the same folder and contents.

    Add Reset Permissions to Context Menu in Windows
      My Computers


  3. Posts : 2
    windows 10
       #612

    Brink said:
    Hello Warsong, and welcome.

    You could see if using "Reset Permissions" below may restore the default permissions of the same folder and contents.

    Add Reset Permissions to Context Menu in Windows
    Your solution worked for the majority of problems! There's a slight change in OS operation as it's now adamant that things are "run as admin". Firefox profile got locked somehow still figuring that one out.

    Thank you much for taking the time Brink. I still appreciate the script as well. It's only running with scissors that got me into trouble.
    Need to take time to fully understand tools before using them.
      My Computer


  4. Posts : 68,994
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #613

    Warsong said:
    Your solution worked for the majority of problems! There's a slight change in OS operation as it's now adamant that things are "run as admin". Firefox profile got locked somehow still figuring that one out.

    Thank you much for taking the time Brink. I still appreciate the script as well. It's only running with scissors that got me into trouble.
    Need to take time to fully understand tools before using them.
    I'm glad it was able to help sort most of the problems.

    If you have to, you could try uninstalling and reinstalling Firefox to see if that may sort its permissions.
      My Computers


  5. Posts : 274
    WIN10
       #614

    Not a big deal and hopefully it wasn't already discussed (I scanned a bit, didn't see) but, does anyone know what is different in this and the old faithful (seems simpler) version I been using since Windows 2000? Any reason not to use the old version?

    Code:
    [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"
      My Computer


  6. Posts : 68,994
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #615

    Quexos said:
    Not a big deal and hopefully it wasn't already discussed (I scanned a bit, didn't see) but, does anyone know what is different in this and the old faithful (seems simpler) version I been using since Windows 2000? Any reason not to use the old version?

    Code:
    [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"
    Hello mate,

    The new version is more compatible, and includes more safety measures to prevent taking ownership of specific system folders or drives that could break something.
      My Computers


  7. Posts : 274
    WIN10
       #616

    Brink said:
    Hello mate,

    The new version is more compatible, and includes more safety measures to prevent taking ownership of specific system folders or drives that could break something.
    Alright, Thanks. Sound good, plus I kind of like the "HasLUAShield" part.
      My Computer


  8. Posts : 776
    Windows 7
       #617

    Brink,

    I've improved the Context Menu, making "takeown /d y" work for all languages beside English. While I tested it for taking over folders and drives, you might want to confirm the changes for yourself.

    Drive block's AppliesTo was moved up a few lines to stay consistent with Directory's order.

    Code:
    Windows Registry Editor Version 5.00
    
    ; Created by: Shawn Brink
    ; Created on: January 28, 2015
    ; Updated on: January 11, 2021
    ; Tutorial: https://www.tenforums.com/tutorials/3841-add-take-ownership-context-menu-windows-10-a.html
    
    
    
    [-HKEY_CLASSES_ROOT\*\shell\TakeOwnership]
    [-HKEY_CLASSES_ROOT\*\shell\runas]
    
    [HKEY_CLASSES_ROOT\*\shell\TakeOwnership]
    @="Take Ownership"
    "Extended"=-
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    
    [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)\")"
    "Extended"=-
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "Position"="middle"
    
    [HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership\command]
    @="powershell -windowstyle hidden -command \"$Y = ($null | choice).Substring(1,1); 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 \"$Y = ($null | choice).Substring(1,1); 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\""
    
    
    
    [HKEY_CLASSES_ROOT\Drive\shell\runas]
    @="Take Ownership"
    "AppliesTo"="NOT (System.ItemPathDisplay:=\"C:\\\")"
    "Extended"=-
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "Position"="middle"
    
    [HKEY_CLASSES_ROOT\Drive\shell\runas\command]
    @="cmd.exe /c for /f \"tokens=1,2 delims=[,]\\\" %Y in ('"choice <nul 2>nul"') do takeown /f \"%1\\\" /r /d %Y && icacls \"%1\\\" /grant *S-1-3-4:F /t /c"
    "IsolatedCommand"="cmd.exe /c for /f \"tokens=1,2 delims=[,]\\\" %Y in ('"choice <nul 2>nul"') do takeown /f \"%1\\\" /r /d %Y && icacls \"%1\\\" /grant *S-1-3-4:F /t /c"
      My Computer


  9. Posts : 68,994
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #618

    garlin said:
    Brink,

    I've improved the Context Menu, making "takeown /d y" work for all languages beside English. While I tested it for taking over folders and drives, you might want to confirm the changes for yourself.
    Thank you garlin. They work great on my end. Tutorial now updated for this.
      My Computers


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

    garlin said:
    Brink,

    I've improved the Context Menu, making "takeown /d y" work for all languages beside English. While I tested it for taking over folders and drives, you might want to confirm the changes for yourself.

    Drive block's AppliesTo was moved up a few lines to stay consistent with Directory's order.

    Code:
    [HKEY_CLASSES_ROOT\Drive\shell\runas]
    @="Take Ownership"
    "AppliesTo"="NOT (System.ItemPathDisplay:=\"C:\\\")"
    "Extended"=-
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "Position"="middle"
    
    [HKEY_CLASSES_ROOT\Drive\shell\runas\command]
    @="cmd.exe /c for /f \"tokens=1,2 delims=[,]\\\" %Y in ('"choice <nul 2>nul"') do takeown /f \"%1\\\" /r /d %Y && icacls \"%1\\\" /grant *S-1-3-4:F /t /c"
    "IsolatedCommand"="cmd.exe /c for /f \"tokens=1,2 delims=[,]\\\" %Y in ('"choice <nul 2>nul"') do takeown /f \"%1\\\" /r /d %Y && icacls \"%1\\\" /grant *S-1-3-4:F /t /c"
    Hey mate.

    I just noticed the commands were not getting added to the registry for the "Drive" bit above when merging as a REG file.
      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 11:43.
Find Us




Windows 10 Forums