Solved! Here is what I did, so others can use this if it helps. For a while, it seemed nothing could get rid of them…
- (Lots of stuff that didn’t work, false starts, etc., attempting to change ownership, etc. The “special privileges” on the files caused everything I tried to fail. I had some limited success with changing the owner of individual files to my UserID, but that was hit and miss, and very slow for trying to deal with 700+ files.
- Enabled the local Administrator account login for MYMACHINE. The password got automatically changed (group policy settings at our shop?) when I rebooted, so not sure this accomplished anything until later on. The command I used was:
net user administrator /active:yes
- Disabled UAC from the command line of the Administrator account. Not sure this wound up accomplishing anything either.
- Did Cut and Paste to move all the folders to C:\Temp folder. This actually moved the files! I tried this in random thrashing around, and was surprised it was successful at moving the files. Note that the original problem still persisted, that I still could not delete any files from the subfolders of the Temp folder, about 8GB worth of space hogging files.
- Started up a Command Prompt, running as Administrator.
- Changed the password on the MYMACHINE\Administrator account to “mypw5678!”
- Executed the following TAKEOWN command, to take ownership of the files (assign ownership to Administrators group):
TAKEOWN /S MYMACHINE /U MYMACHINE\Administrator /P mypw5678! /F C:\Temp*.* /A /R
This command takes ownership of everything under the Temp folder. The /S /U and /P parameters tell the command to run in “remote” mode, using the UserID and Password of the local Administrator account I had enabled. The /A parameter tells TAKEOWN to set the owner to the “Administrators” group, of which I am a member. The /R parameter tells the command to recurse through all subfolders and operate on all matching files there. The command ran without errors and listed all the files processed.
- Executed the following ICACLS command:
ICACLS C:\Temp*.* /grant myuserid:F /T /C
This command grants “:F”ull access to user myuserid for all the files and folders under C:\Temp. The /T parameter says to recursively run the command against all matching files and folders in the subfolder Tree below. The /C parameter says to continue processing even if errors are encountered on some files. The command ran without errors and listed all the files processed.
- After this, I was able to use Windows Explorer to go in and delete all the folders below C:\Temp, with no further tweaks.
- Disabled local Administrator account login. The command used was
net user administrator /active:no
Note: Most of the junk files and folders were from failed installs of SQLExpress 2005, a Windows update that applied to my system. For some reason, the update failed about 30 times in a row before succeeding, and then left 8GB of garbage install files in hex-named folders at the root of my C: drive. Folders had names like
Good luck, sorry for the formatting, copied directly from an Outlook Email, and I hope this saves someone the hours of frustration it caused me.