Reset Windows password

From GigaTux Wiki
Revision as of 15:56, 3 February 2016 by Cocodude (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Resetting a Windows password is a fairly painful process. Make sure the VPS is fully off before doing this.

Run parted /dev/lvm1/xenXX to get details of the full disk image.

Then type unit and then B to show the units in bytes. Then type p to print the partition list. You will get something like:

(parted) p                                                                
Model: Linux device-mapper (linear) (dm)
Disk /dev/dm-18: 32212254720B
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start       End           Size          Type     File system  Flags
 1      1048576B    368050175B    367001600B    primary  ntfs         boot
 2      368050176B  32211206143B  31843155968B  primary  ntfs

We want partition 2, so note down the start offset.

Create a new directory, e.g. /win, and mount that. If you're not sure what you're doing, mount read only, but if you need to actually change the password, you can mount rw:

 mount -o ro,offset=368050176 /dev/lvm1/xenXX /win

Now /win contains the contents of the NTFS filesystem.

cd to the directory containing the password information:

 cd /win/Windows/System32/config

And use the utility chntpw (installable from the Debian repositories) to update the Administrator password. The version that works with Windows Server is available in Jessie (not Wheezy) so feel free to use the static version from the download at the source website.

 chntpw -u Administrator SAM

Select 2 to edit or clear the user password, change it, unmount /win and boot up the VPS again.