Q1. Restoring ownership or access
The behavior is consistent with a file whose NTFS metadata (owner/ACL) is corrupted or whose name/metadata prevents normal tools from reaching it. When the standard Security UI and ownership change both fail with “Access is denied,” use low‑level tools that bypass the normal Win32 path parsing and ACL editor:
- Use the
\\?\path syntax plus SubInACL to reset owner and permissions on that single file:- Install the Windows Resource Kit tools (which include
subinacl.exe). - From an elevated Command Prompt on the server, run a command in this form (single line):
Replacesubinacl /onlyfile "\\?\C:\full\path\to\problem_file.ext" /setowner=DOMAIN\Administrator /grant=DOMAIN\Administrator=FC:\full\path\to\problem_file.extandDOMAIN\Administratorwith the actual path and an account that should own the file. - This forces ownership and full control even when the GUI ACL editor cannot access the file.
- After this succeeds, delete or adjust permissions using the same
\\?\syntax if needed.
- Install the Windows Resource Kit tools (which include
If the problem is purely ACL/ownership corruption, this approach is the supported way to regain control.
Q2. Forcibly removing the file if ownership cannot be recovered
If the ACL/owner cannot be repaired or the file is otherwise inaccessible, the recommended forced‑removal procedure is:
- Try deleting via
delwith\\?\syntax from an elevated Command Prompt on the server:
This bypasses normal path parsing and can delete files with problematic names (trailing spaces, invalid characters, etc.).del "\\?\C:\full\path\to\problem_file.ext" - If the file is on an Azure Files share and the issue is an orphaned handle or lease (for example, the editing session left the file locked), close the handle/lease from the storage side:
- Use
Get-AzStorageFileHandleto list open handles on the file. - Use
Close-AzStorageFileHandleto force close them. - If a REST lease exists, break it using a
ShareLeaseClientandBreak().
- Use
If neither ACL repair (SubInACL) nor handle/lease closure works, the remaining options are low‑level disk tools or restoring from backup and removing the affected volume/file via offline maintenance, but those are beyond what is documented in the provided context.
References: