Can't Delete a File and Take Ownership

Maranya, Damon 316 Reputation points
2023-05-18T20:56:20.0766667+00:00

I have a user with a PDF file on the desktop of their Windows 10 Azure VDI that they are unable to delete.

When they try, they get an Access Denied error. But the file properties are missing the Security tab. So, it is not possible to take ownership of the file. It is the only file in the folder that is missing the security tab. All other files in the same folder have a Security tab and a change of ownership completes successfully. The file is not set to Read Only either.

A recursed Get-ChildItem on the folder holding the file returns a list with the offending PDF in it, and the file is also visible in File Explorer.

But the following command returns "Cannot find path".

Get-ChildItem -Path '\\DeviceName\c$\Users\username\Desktop' -Filter "*.pdf" -Recurse | Get-AcL

A less specific version returns a list of files that does not include the PDF in question and the same "Cannot find path" error as the command above.

Get-ChildItem -LiteralPath 'DeviceName\c$\Users\username\Desktop' -Recurse | Get-AcL

Does anyone have any ideas on how to deal with this rogue file without wiping her VDI profile?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,617 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 43,931 Reputation points
    2023-05-19T11:32:53.1433333+00:00

    Hello

    Thank you for your question and reaching out.

    1. First, make sure that the drive is formatted with the NTFS file system. If the drive is formatted as FAT32 or exFAT
    2. Please check GPO -> Go to User Configuration -> Windows Components -> File Explorer -> Change the value of the Remove Security Tab to Disabled or Not Configured.
    3. Please login using Local Admin or Member of Administrator Group to this Machine and try to take ownership.

    --If the reply is helpful, please Upvote and Accept as answer--