I have dedicated Windows7 (not on domain) virtual machine for overnight automation testing. Some commands (mySQLdump, tscon.exe) must be run under administrator account.

Last week administrator account's profile was corrupted. I fixed it by renaming it in the registry and logging in as administrator. And today it is corrupted again.

I use administrator account only to run above commands via runas. Also the computer is restarted via cmd - shutdown command - quite often. Especially every night before automation testing starts.

I checked the comp for viruses - did full scan using avast although I believed that the comp is clean.

Any idea how to prevent the profile to get corrupted again?


So the first log entry in event log is today from 1.15am and one of my scripts ran runas command as administrator exactly at 1.15am. It was second time that runas war executed though after the testing started. The same happened second day in a row. Before the testing starts I need to copy one file that is locked. So I run handle.exe from runas to unlock it. That is what I think causing the profile to get corrupted. I am not able to reproduce it by myself.

The message from event viewer is

Windows cannot load the locally stored profile. Possible causes of this error include insufficient security rights or a corrupt local profile.

DETAIL – The process cannot access the file because it is being used by another process.
  • 2
    Find out what's causing the corruption. What takes place around the time of the corruption? Is it a registry corruption? File system? – user3463 Oct 17 '12 at 3:53
  • I have no idea. I find out only when I need to run runas which might be hours after the corruption happend. I was told that 'corrupted profile on Windows7' is a common thing. – Radek Oct 17 '12 at 3:57

Corrupted profiles are kind of a common problem, but it's still a problem; One that's a symptom of a larger problem. It's "common", but not "normal".

On the other hand, based on the provided event log entry, your profile isn't corrupted, it just can't be loaded because during loading it's trying to access a file that's locked by another process (like it says). You have to determine what the file is, and why it's locked.

If you suspect it's your use of Handle.exe, maybe figure out another way to release the file you need to copy without abruptly closing handles, as that's highly unsafe. If you look at the usage info for Handle it even warns you "WARNING: Closing handles can cause application or system instability.". :)

| improve this answer | |
  • hmmm, I suspect handle.exe but I cannot be sure. Also it doesn't happen always. Looks like it happens second time it is used. – Radek Oct 19 '12 at 0:40
  • The process that locked the file runs under the account I log in every time not the admin. How could it hold any file in administrators profile? – Radek Oct 19 '12 at 0:44

I had my user profile corrupted numerous times and had to rename or create new user profiles to use the computer. It turns out that this was happening when the computer would sleep or shut down while a McAfee virus scan was running. I have changed the power settings so that it never sleeps or shuts down and the problem has gone away.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.