Delete TrustedInstaller-only Files and Folders

Delete TrustedInstaller-only Files and Folders
Not very security related, but something I don’t want to forget how to do. It was a PITA. So I had a old WINDOWS directory that I needed to get rid of. And the following commands gave me the ooomph needed to get the job done.

1) Get a SYSTEM shell so all modding of permissions will be good.

D:\> psexec /accepteula -s cmd

2) Grant Administrators FULL rights to the directory and all sub directories and files

D:\> icacls D:\Windows\* /grant Administrators:F /C /T

3) Finish the job, delete the folder and everything below it

D:\> rmdir /s /q D:\Windows\

All done. Weeeeeeeee!

If you have a better way to do this via commands or programs please let me know, always looking to learn more




@echo OFF
rem french windows
icacls “S:\Windows\SysWOW64\notepad.exe” /grant Administrateurs:F /C /T

rem eng
icacls %homedrive%\Windows\* /grant Administrators:F /C /T