• Home /
  • windows /
October 21, 2019

3 Ways to Delete Files Protected by TrustedInstaller in Windows 10

How to Delete Files Protected by TrustedInstaller in Windows 10: TrustedInstaller is a process of Windows Modules Installer which owns lots of system files, folders, and other programs. Yes, TrustedInstaller is the user account used by Windows Modules Installer service to own control to these protected system files and folders. And yes even if you’re administrator they are not owned by you and you can’t modify these files in any way.

3 Ways to Delete Files Protected by TrustedInstaller in Windows 10

If you try to rename, delete, edit these files or folders which are owned by TrustedInstaller you will end up getting an error message saying “You do not have permission to perform this action” and “You need permission from TrustedInstaller to make changes to this file or folder”.

Well, don’t worry in order to delete files protected by TrustedInstaller in Windows 10 you have to first take the ownership of the file or folder which you’re trying to delete. Once you have the ownership then you can grant full control or permission to your user account.

Can I delete the TrustedInstaller user account from file ownership?

In short, yes you can and it’s important that you don’t because TrustedInstaller user account is created to protect system files and folders, for example, if virus or malware attack on your PC then they won’t be able to modify system files or folders because these files & folders are protected by TrustedInstaller. And if you still try to delete the TrustedInstaller user account from file ownership, you will get an error message saying:

You can’t remove TrustedInstaller because this object is inheriting permissions from its parent. To remove the TrustedInstaller, you must prevent this object from inheriting permissions. Turn off the option for inheriting permissions, and then try again.

As easy may it sound but the process to take ownership of a file is a little longer but don’t worry that’s why we are here. In this article, I will walk you through the step by step guide on How to Delete Files Protected by TrustedInstaller in Windows 10 by taking the ownership of the file or folder back from TrustedInstaller.

3 Ways to Delete Files Protected by TrustedInstaller in Windows 10

Make sure to create a restore point just in case something goes wrong.

Method 1: Manually Take Ownership of Files or Folders in Windows 10 

1.Open the file or folder for which you want to take the ownership back from TrustedInstaller.

2.Right-click on the particular file or folder and select Properties.

Right-click on any folder or file then select Properties option

3.Switch to the Security tab then click on the Advanced button.

Switch to Security tab then click on the Advanced button

4.This will open the Advanced Security Settings window where you can see that the TrustedInstaller has the Full Control on this particular file or folder.

TrustedInstaller has the Full Control on this particular file or folder

5.Now next to Owner name (which is TrustedInstaller) click on Change.

6.This will open the Select User or Group window, from where again click on the Advanced button at the bottom.

Click on Advanced option again | Fix You Need Permission To Perform This Action Error

7.A new window will open, click on the “Find Now” button.

8.You will see all the user account listed in the “Search results:” section, select the user account from this list to make the new owner of file or folder and click OK.

Click on Find Now then select your user account then click OK

9.Again click OK on the Select User or Group window.

Once you select the user account then click OK

10.Now you will be on Advanced Security Settings window, here checkmarkReplace owner on subcontainers and object” if you need to delete more than one file in a folder.

Checkmark Replace owner on subcontainers and objects

11.Click Apply followed by OK.

12.From the folder or file properties window, again click on the Advanced button under the Security tab.

Switch to Security tab then click on the Advanced button

13.No click on Add button to open the Permissions Entry window, then click on “Select a principal” link.

Add to change user control

click select a principal in advanced security settings of packages

14.Again click Advanced button then click on Find Now.

15.Select the user account you selected in step 8 and click OK.

Once you select the user account then click OK

16.You will be again taken to the Permissions Entry window, from where you need to checkmark all the boxes under “Basic permissions“.

select a principal and add your user account then set full control check mark

17.Also, checkmarkOnly apply these permissions to objects and/or containers within this container” and click OK.

18.You will get a security warning, click Yes to continue.

19.Click Apply followed by OK, and again click OK on the file/folder properties window.

20.You have successfully changed the ownership of the file or folder, now you can modify, edit, rename or delete that file or folder easily.

Now you can easily delete files protected by TrustedInstaller in Windows 10 using the above method, but if you don’t like to go through this lengthy process then you could also use the below method to add “Take Ownership” option to the right-click context menu and easily take ownership of any file or folder in Windows 10.

Method 2: Take Ownership of Files/Folders in Windows 10 using Registry

1.Open Notepad file then copy and paste the following code into the notepad file:

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT*shellrunas]

[HKEY_CLASSES_ROOT*shellrunas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Position"="middle"

[HKEY_CLASSES_ROOT*shellrunascommand]
@="cmd.exe /c takeown /f "%1" && icacls "%1" /grant administrators:F /c /l & pause"
"IsolatedCommand"="cmd.exe /c takeown /f "%1" && icacls "%1" /grant administrators:F /c /l & pause"

[-HKEY_CLASSES_ROOTDirectoryshellrunas]

[HKEY_CLASSES_ROOTDirectoryshellrunas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Position"="middle"

[HKEY_CLASSES_ROOTDirectoryshellrunascommand]
@="cmd.exe /c takeown /f "%1" /r /d y && icacls "%1" /grant administrators:F /t /c /l /q & pause"
"IsolatedCommand"="cmd.exe /c takeown /f "%1" /r /d y && icacls "%1" /grant administrators:F /t /c /l /q & pause"

[-HKEY_CLASSES_ROOTdllfileshellrunas]

[HKEY_CLASSES_ROOTdllfileshellrunas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Position"="middle"

[HKEY_CLASSES_ROOTdllfileshellrunascommand]
@="cmd.exe /c takeown /f "%1" && icacls "%1" /grant administrators:F /c /l & pause"
"IsolatedCommand"="cmd.exe /c takeown /f "%1" && icacls "%1" /grant administrators:F /c /l & pause"

[-HKEY_CLASSES_ROOTDriveshellrunas]

[HKEY_CLASSES_ROOTDriveshellrunas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Position"="middle"

[HKEY_CLASSES_ROOTDriveshellrunascommand]
@="cmd.exe /c takeown /f "%1" /r /d y && icacls "%1" /grant administrators:F /t /c /l /q & pause"
"IsolatedCommand"="cmd.exe /c takeown /f "%1" /r /d y && icacls "%1" /grant administrators:F /t /c /l /q & pause"

[-HKEY_CLASSES_ROOTexefileshellrunas]

[HKEY_CLASSES_ROOTexefileshellrunas]
"HasLUAShield"=""

[HKEY_CLASSES_ROOTexefileshellrunascommand]
@=""%1" %*"
"IsolatedCommand"=""%1" %*"

2.From Notepad menu click on File then select Save As.

From Notepad menu click on File then select Save As

3.From the Save as type drop-down select “All Files (*.*)” and then type the name of the file which can be anything you want but make sure to add .reg at the end of it (e.g. takeownership.reg) because this extension is very important.

name the file to Registry_Fix.reg (the extension .reg is very important) and click Save

4.Navigate to where you want to save the file preferably the desktop and click on the Save button.

5.Now right-click on the above file (Registry_Fix.reg) and select Install from the context menu.

Note: You will need an administrator account to install the script to Windows registry files.

6.Click Yes to add the above code to Windows Registry.

7.Once the above script is successfully installed, you can easily take the Ownership of any file or folder you want by simply right-clicking on it and then select “Take Ownership” from the context menu.

right click take ownership

8.However, you can uninstall the above script any time you want by again following the steps from 1 to 4 but this time, use the following code:

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT*shellrunas]
[-HKEY_CLASSES_ROOTDirectoryshellrunas]
[-HKEY_CLASSES_ROOTdllfileshellrunas]
[-HKEY_CLASSES_ROOTDriveshellrunas]
[-HKEY_CLASSES_ROOTexefileshellrunas]
[HKEY_CLASSES_ROOTexefileshellrunas]
"HasLUAShield"=""

[HKEY_CLASSES_ROOTexefileshellrunascommand]
@=""%1" %*"
"IsolatedCommand"=""%1" %*"

9.And save the file with the name Uninstallownership.reg.

10.If you want to remove the “Take Ownership” option from the context menu, then double-click on the Uninstallownership.reg file and click on Yes to continue.

Method 3: Use 3rd Party Application to Change Ownership of A File or Folder

With the help of the Take Ownership application, you would be easily able to take ownership of any file or folder you want and then delete files protected by TrustedInstaller. The application works the same as the above method but you only need to install the software with or without admin rights instead of manually making the script yourself.

Just install the Take Ownership application and it will add the “Take Ownership” option in the right-click context menu of Windows 10.

Recommended:

I hope the above steps were able to help you Delete Files Protected by TrustedInstaller in Windows 10 but if you still have any questions regarding this guide or TrustedInstaller service then feel free to ask them in the comment’s section.