New
#1
Question/help about take ownership context menu - excluding ext device
Hello and Merry Christmas
Can someone help me to modify "take ownership" context menu to thing i wanna achieve?
I want to modify this reg to make windows take ownership context menu not appear on any device that is not my physical internal drive and exclude from appearing in for example on usb thumb stick or cd/dvd drive or sd card and so on
This reg below is slightly modified of tutorial link to my liking
Add Take Ownership to Context Menu in Windows 10
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 full control admin v2" "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 :r administrators:F /t /c /l /remove:g BUILTIN && attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" & attrib -r -s -h -i \"%1\\*.*\" /s /d' -Verb runAs\"" "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" && icacls \\\"%1\\\" /grant :r administrators:F /t /c /l /remove:g BUILTIN && attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" & attrib -r -s -h -i \"%1\\*.*\" /s /d' -Verb runAs\"" [HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership] @="take full control admin v2" "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 \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" /r /d y && icacls \\\"%1\\\" /grant :r administrators:F /t /c /l /q /remove:g BUILTIN && attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" & attrib -r -s -h -i \"%1\\*.*\" /s /d' -Verb runAs\"" "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c takeown /f \\\"%1\\\" /r /d y && icacls \\\"%1\\\" /grant :r administrators:F /t /c /l /q /remove:g BUILTIN && attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" & attrib -r -s -h -i \"%1\\*.*\" /s /d' -Verb runAs\"" [HKEY_CLASSES_ROOT\Drive\shell\runas] @="take full control admin v2" "Extended"=- "HasLUAShield"="" "NoWorkingDirectory"="" "Position"="middle" "AppliesTo"="NOT (System.ItemPathDisplay:=\"C:\\\")" [HKEY_CLASSES_ROOT\Drive\shell\runas\command] @="cmd.exe /c takeown /f \"%1\\\" /r /d y && icacls \"%1\\\" /grant :r administrators:F /t /c /remove:g BUILTIN && attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" & attrib -r -s -h -i \"%1\\*.*\" /s /d" "IsolatedCommand"="cmd.exe /c takeown /f \"%1\\\" /r /d y && icacls \"%1\\\" /grant :r administrators:F /t /c /remove:g BUILTIN && attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" && cmd /c attrib -r -s -h -i \"%1\" & attrib -r -s -h -i \"%1\\*.*\" /s /d"
I can see there is "AppliesTo" thing that excludes context menu from appearing on different C locations
but i want to context menu not appear additionally on anything that is not internal drive for example:
1. I want context menu to appear on windows HDD/SSD on regardless of number of partitions: ex: C D E F G ... that belongs to internal HDD/SSD of PC
2. I dont want this context menu appear on things like:
- plugged in removable sd card
- plugged in removable any phone/smartphone/gps device and so on
- plugged in removable usb thumb stick
- plugged in removable external HDD/SSD/HYBRID drive
- internal CD/DVD drive in my tower (connecteby sata)
- any other plugged in removable usb devices
*3. Additionally i want this context menu to work on different language OS than English (currently testing this on English only os but i want it to work on different OS that have different naming of system folders (for example Program FIies folder is Eine Programme on different language OS)
I was looking into it for some time and couldnt find an answer even though script from tutorial has lines that excludes some C system folders from menu appearing.
OS: Win 10 x64 Pro 22H2 Build 19045.2965
Thanks and Merry Christmas for everyone