0

I've got myself into a situation on a Windows Server 2016 machines where I've somehow ended up with corrupt files in my %TEMP% directory (which on my system is in C:\users\username\appdata\local\Temp), as a result of some MDT activities that went bad. They are preventing some MDT functions from working properly.

When I try to delete a file as domain admin, it tells me I don't have permission. When I try to open the file, it says "the file cannot be accessed by the system". chkdsk says the file system is clean. I even tried booting into a boot CD, parted magic, and trying to delete the file from a browser there. I get an error there saying the file is corrupted. None of the disk checking tools I've tried have said there are any problems.

I'm almost at the point where I need to reinstall the OS, but thought I'd post here as a last-ditch effort.

Any help is greatly appreciated.

3
  • Check the Permissions and see who/what has permissions. If you don't need the file, you can probably safely force ownership on the file to the network admin, and then delete.
    – Stese
    Commented Apr 25, 2017 at 14:29
  • @stevendavidson Most of the files were owned by 'TrustedInstaller', but I changed ownership to myself (domain administrator) and opened up the permissions to allow the domain administrator to do everything to that file. Based on the fact that it won't even let me open it, telling me it doesn't exist on the system, seems like it's different than permission issues I've seen in the past.
    – prelic
    Commented Apr 25, 2017 at 14:36
  • what happens when you try to delete it from an elevated command prompt using wildcards? ie: from the temp directory, "del *.*"
    – Rex
    Commented Apr 25, 2017 at 19:03

2 Answers 2

1

Try to use "takeown" command from cmd (elevated). For example: takeown /f C:\users\username\appdata\local\Temp /r

It will replace the owner of all dirs/subdirs and files recursively, so you must get access to clean up your temp folder

0

Method 1
In case it's a permission issue and even as an Admin you can't delete the files or take ownership I'd recommend trying to delete / take ownership as system user using psexec:

PSEXEC.exe -i -s -d CMD.exe

Download PsExec and start an elevated command prompt (run as Admin). Then go to the folder where you placed psexec.exe and run the above command. A new command shell should appear. I you type whoami it should return

nt authority\system or similar.

A bit more details are listed here

Method 2
I've also seen cases where too long filenames generate the greatest error messages. Try moving the contents of the temp folder directly to C:\Temp or similar. Might already work then. If not, try deleting single files / folders and see if only some of them generate errors.

Method 3
Are the files maybe opened by some process? Find one file that you can't delete / open / take ownership and search for the filename in Process Explorer

4
  • If he already booted from a disc and wasn't able to delete the file from outside the OS, I don't think it'll work from within the OS.
    – Daniel
    Commented Apr 25, 2017 at 21:43
  • 1
    He wrote Parted Magic. Which has a Linux beneath. Trying to modify files on a NTFS file system. And Parted Magic is using NFTS-3G to access NTFS. Depending in which version they're using it's either instable or is bound to the same file permissions. So I wouldn't trust the result of that too much :)
    – adiuva
    Commented Apr 25, 2017 at 21:51
  • Well, fair enough :)
    – Daniel
    Commented Apr 26, 2017 at 9:57
  • Thanks for the follow up guys. Still no luck, I've tried removing them as system with psexec, ran handle and rebooted to make sure there were no open handles to the files, and have booted outside the drive. Pmagic has to know the file system unless you want to nuke the whole thing, which I did not want to do...very odd, first time I haven't been able to force my way through.
    – prelic
    Commented May 8, 2017 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .