Accounts Add Take Ownership to Context Menu in Windows 11


Owner_banner.png

This tutorial will show you how to add Take Ownership to the context menu of all files, folders, and drives for all users in Windows 10 and Windows 11.

This will allow you to be able to instantly take ownership of a file, folder (and all contents), or drive (and all contents) by changing the owner to the current user and grant the Owner_Rights SID (for current owner) full access permission.

When you right click or press and hold on a file, folder, or drive, click/tap on Show more options, and click/tap on Take Ownership, you will be prompted by UAC for approval first.

If a user is signed in as an administrator, then the user would just click/tap on Yes to approve and take ownership. The owner of the file, folder, or drive would be changed to the current user account. Permissions would be set to allow this current owner (Owner_Rights SID) full control of the file, folder, or drive.

If a user is signed in as a standard user, then the user would need to enter a selected administrator's password to approve and take ownership. The owner of the file, folder, or drive would be changed to the selected administrator account and not the standard user. Permissions would be set to allow this current owner (Owner_Rights SID) full control of the file, folder, or drive.

The Take Ownership context menu will not be available when you right click or press and hold only on the specific C: drive, C:\Program Files folder, C:\Program Files (x86) folder, C:\ProgramData folder, C:\Users folder, and C:\Windows folder. This was done by design since taking ownership of the Windows "C:" drive and these specific system folders can make Windows unstable as it would also take ownership of all their content at the same time.

You will still be able to use the Take Ownership context menu on files and folders inside the locations above, and on all drives other than the C drive and FAT32 drives.

Application files (ex: EXE, CMD, MSI) will have the Take Ownership context menu without replacing Run as administrator.

You must be signed in as an administrator to add, remove, and use the "Take Ownership" context menu.


Taking Ownership of a FAT32 drive will not work and you will get an error indicating so since file permissions are only supported on NTFS and ReFS drives.


If you would like to have a custom location(s) of your own to not show the context menu for, then please feel free to post a request in this tutorial thread. I'll be happy to post back with a custom .reg file for it.



EXAMPLE: Take Ownership context menu

In Windows 11, you will need to click/tap on Show more options first by default, then click/tap on Take Ownership.


Take_Ownership-drive.webp
Show_more_options.png
Take_Ownership_context_menu.png



Here's How:

1 Do step 2 (add), step 3 (add w/pause), or step 4 (remove) below for what you would like to do.

2 Add "Take Ownership" to Context Menu

A) Click/tap on the Download button below to download the .reg file below, and go to step 5 below.​

Add_Take_Ownership_to_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[-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"
"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 *S-1-3-4:F /t /c"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\\\" /r /d y && icacls \"%1\\\" /grant *S-1-3-4:F /t /c"

3 Add "Take Ownership" with Pause to Context Menu

This option does the same as step 2, except includes pausing the command when you use the "Take Ownership" context menu to be able to see the command results. This can be handy to verify if changing ownership and permissions was successfully processed or not.

Take_Ownership_with_pause.png


A) Click/tap on the Download button below to download the .reg file below, and go to step 5 below.​

Add_Take_Ownership_with_Pause_to_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[-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 & pause' -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 & pause' -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 & pause') -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 & pause') -Verb runAs\""



[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Take Ownership"
"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 *S-1-3-4:F /t /c & Pause"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\\\" /r /d y && icacls \"%1\\\" /grant *S-1-3-4:F /t /c & Pause"

4 To Remove "Take Ownership" from Context Menu

This is the default setting.


A) Click/tap on the Download button below to download the .reg file below, and go to step 5 below.​

Remove_Take_Ownership_from_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\*\shell\TakeOwnership]

[-HKEY_CLASSES_ROOT\*\shell\runas]

[-HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership]

[-HKEY_CLASSES_ROOT\Drive\shell\runas]

5 Save the .reg file to your Desktop.

6 If you have Smart App Control turned on, you will need to unblock the downloaded REG file.

7 Double click/tap on the downloaded .reg file to merge it.

8 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

9 When finished, you can delete the downloaded .reg file if you like.


That's it,
Shawn Brink


 

Attachments

Last edited:
I think the biggest problem is users confusing "Take Ownership" with "Grant Me Access Rights". When it's personal data files, taking ownership is very convenient. But for any system or application folders, it's inherently dangerous since most users don't understand Windows' inheritance model for permissions.

Taking ownership can mean the original (system) owners of that folder/file are locked out, and Windows programs will stop working.

It's an education issue for users.
 

My Computer

System One

  • OS
    Windows 7
@Brink This is very strange, it turns out the posted .reg file in Step 2 was corrupted, and it really didn't work when tried updating it.

1. Wildcard deletions are not supported within a .reg file, so -[...\*\...] is invalid.

2. My method for determining your locale's answer for "Yes" or "Y" was supposed to be choice <NUL 2>NUL from CMD, but that got truncated. This resulted in choice timing out after a few seconds, but not before making annoying beep noises.

3. I shouldn't have replaced "@" in the command section. Got confused with the "@" working as a tag in the top section.

4. I've submitted two versions of a working Take Ownership .reg file. The debug version leaves the elevated CMD shell open, so you can visually confirm that it has indeed correctly executed takeown and icacls.

5. FYI -- If you takeown an entire drive, you will break the Recycle Bin that's on it and will have to make a new one. Oh well.

@Andy_DFW: Try the debug version first, so you can see the commands in action. If that's good, you can switch to the normal (and silent) version.

Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership]
[-HKEY_CLASSES_ROOT\Drive\shell\TakeOwnership]

[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 -C \"$Yes=(cmd /c 'choice <NUL 2>NUL').Substring(1,1); $Path='%1'; Start-Process cmd -ArgumentList ('/c takeown /f \\\"{0}\\\" /r /d {1} && icacls \\\"{2}\\\" /grant *S-1-3-4:F /t /c /l /q' -f $Path,$Yes,$Path) -Verb RunAs\""
"IsolatedCommand"="powershell -WindowStyle Hidden -C \"$Yes=(cmd /c 'choice <NUL 2>NUL').Substring(1,1); $Path='%1'; Start-Process cmd -ArgumentList ('/c takeown /f \\\"{0}\\\" /r /d {1} && icacls \\\"{2}\\\" /grant *S-1-3-4:F /t /c /l /q' -f $Path,$Yes,$Path) -Verb RunAs\""


[HKEY_CLASSES_ROOT\Drive\shell\TakeOwnership]
@="Take Ownership"
"AppliesTo"="NOT (System.ItemPathDisplay:=\"C:\\\")"
"Extended"=-
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Position"="middle"

[HKEY_CLASSES_ROOT\Drive\shell\TakeOwnership\command]
@="powershell -WindowStyle Hidden -C \"$Yes=(cmd /c 'choice <NUL 2>NUL').Substring(1,1); $Path='%1'; Start-Process cmd -ArgumentList ('/c takeown /f {0} /r /d {1} && icacls {2} /grant *S-1-3-4:F /t /c /l /q' -f $Path,$Yes,$Path) -Verb RunAs\""
"IsolatedCommand"="powershell -WindowStyle Hidden -C \"$Yes=(cmd /c 'choice <NUL 2>NUL').Substring(1,1); $Path='%1'; Start-Process cmd -ArgumentList ('/c takeown /f {0} /r /d {1} && icacls {2} /grant *S-1-3-4:F /t /c /l /q' -f $Path,$Yes,$Path) -Verb RunAs\""

Same.

E:\ is not accessible.
Access is denied
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Dell Inspiron
E:\ is not accessible.
Access is denied
This sounds like you have a security problem, unrelated to the context menu.

You can follow the same steps from an Admin shell (CMD or PowerShell):
Code:
takeown /f E:\ /r /d y
icacls E:\ /grant *S-1-3-4:F /t /c /l /q

Is there something special about this drive? (Protected by BitLocker, FAT32 or exFAT, running some 3rd-party security product)
 

My Computer

System One

  • OS
    Windows 7

Latest Support Threads

Back
Top Bottom