Table of Contents
Problem/Question
I’m facing a challenge in deleting a persistent folder on my computer. No matter what I do, I keep encountering an ‘Access Denied’ message when attempting to delete it.
This particular folder was created by SCCM and contains Windows 11 upgrade files. Even after the system upgrade is complete, this folder remains, causing frustration.
I’ve already tried taking ownership and disabling UAC, but I’m still stuck. I’m looking for suggestions or assistance from anyone who has ideas on how to successfully remove this folder. Please note that I’m unable to install third-party tools for this task. Currently, I’m using icacls.exe to reset permissions on the folder and its subfolders.
Solution
Certainly, here are the solution steps in a clear and expanded format:
Step 1: Change Folder Permissions
Open Command Prompt with administrative privileges. Type the following command and press Enter:
ICACLS.exe C:\foldername /grant:r Administrators:(OI)(CI)F /C
This command grants full control (F) of the folder and its contents (OI)(CI) to the Administrators group.
Step 2: Reset File Permissions
Still in Command Prompt with admin rights, enter the next command:
ICACLS.exe C:\foldername\*.* /reset /T /C
This command resets the permissions on all files and subfolders within ‘foldername’.
Step 3: Open PowerShell as Administrator
Now, open PowerShell with administrator privileges. To do this:
- Press the Windows key.
- Type “PowerShell.”
- Right-click on “Windows PowerShell” in the search results.
- Choose “Run as administrator.”
Step 4: Delete the Stubborn Folder
In the PowerShell window that opens, enter the following command and press Enter:
Remove-Item -Path 'C:\foldername' -Force -Recurse -ErrorAction SilentlyContinue
This PowerShell command forcefully deletes the ‘foldername’ directory and all its contents, and it does so silently, meaning it won’t display errors if there are any issues during deletion.
These steps should help you remove the stubborn folder from your system.