Currently, when I try to delete a folder, sub-folders and files in C:\Windows\System32\DriverStore, a message will pop up, stating: What I do is to manually change the permissions from SYSTEM to the name of the user. Next, I make changes to whatever files that need to be changed. When that is done, I change the permissions back to SYSTEM manually. If someone here on MDL has those two scripts, please share them with me. For security reasons, I do not wish to use third party executables.
write these two simple scripts you need, for yourself. These are take ownership and reset permissions. In the first case, use the takeown.exe gadget on your computer (located in %windir%\System32\takeown.exe) Read about usage here Code: https://theitbros.com/using-takeown-exe-command-to-take-ownership-of-file-or-folder/ or use the icacls.exe gadget on your computer (location %windir%\System32\icacls.exe) Read more about its use here Code: https://theitbros.com/using-icacls-to-list-folder-permissions-and-manage-files/ These pages also have examples. You will find more ready-made variants Code: https://www.google.com/search?q=takeown.exe+command&oq=takeown.exe&aqs=chrome.4.69i57j0l3j0i30l4.16783j0j1&sourceid=chrome&ie=UTF-8 https://www.google.com/search?q=icacls.exe+command+adds&oq=icacls.exe+&aqs=chrome.6.69i57j0i457j0l6.14894j0j1&sourceid=chrome&ie=UTF-8
Here is what I have used for years. These are reg files and scripts to add it all to right-click menu. Then it's very simple to use. Take Ownership and Reset Permissions reg files and scripts. I'm not going to post them here as a script, because that would be a pretty long post then, and I've posted it before. So, everything is included in the attached file. Unzip, you get two folders that have everything you need. Ie scripts for a separate file, for a folder, scripts for directory and all together, as well as registry files separately and all together. You can use or .reg files or .bat scripts or .vbs scripts - select what You like more. (NB Recommended: Run scripts in administrator privileges.)