Tuesday, 29 May 2012

Reset Windows 7 Local Administrator Password

Ever been locked out of your Windows Vista / 7 Machine. Forgot to enable or create an account for that all important day that you get 'no logon servers available' or 'the trust relationship failed' well this has to be the single most, utterly awesome hack known to the IT world in my opinion!

You will need a Windows 7 CD.

1.Boot from the Windows 7 CD and click repair my computer, then follow the prompts to get through to using Advanced tools for repair and then command prompt.


2.Type C: to change letter from (normally) X: to the active partition.
3.Type the following command:
copy c:\windows\system32\sethc.exe c:\

This creates a copy of sethc.exe to restore later.

4.Type this command to replace sethc.exe with cmd.exe:

copy /y c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe

Reboot your computer and start the Windows installation where you forgot the administrator password.

5.After you see the logon screen, press the SHIFT key five times.

6.You should see a command prompt where you can enter the following command to reset the Windows password (see screenshot above):

net user administrator password  <-- replacing 'password' with what you actually want to use.
7. If the account is disabled you also need to run:

net user administrator /active:yes

For anyone who wants to know what we've done here; we're replacing the Sticky Keys executable with a Command Prompt application. Windows will allow you to run Sticky Keys from Pre-Logon so it allows us to boot into a command prompt without authentication.  You will probably not want to leave this open on your desktop so once you've finished I'd recommend you go back into the Recovery environment and replace the setch.exe file with its actual file and purpose again. (backed up to C: as per above)


Did I solve your problem? Buy me a virtual beer by clicking on a Google ad :). Thanks!