Resetting a Windows guest’s Administrator password with guestfish

Gloria Palma González
1 min readOct 13, 2021

This is my own note about how to change the password for Administrator in a qcow2 image using guesfish.

[root@localhost images]# ls -la
total 11719760
drwx--x--x. 2 root root 4096 Oct 13 15:01 .
drwxr-xr-x. 11 root root 4096 Jun 2 2020 ..
-rw-r--r--. 1 zatory zatory 12001017856 Mar 21 2017 windows_server_2012_r2_standard_eval_kvm_20170321.qcow2
[root@localhost images]# guestfish

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: ‘help’ for help on commands
‘man’ to read the manual
‘quit’ to quit the shell

><fs> exit

[root@localhost images]# ls
windows_server_2012_r2_standard_eval_kvm_20170321.qcow2
[root@localhost images]# guestfish -i windows_server_2012_r2_standard_eval_kvm_20170321.qcow2

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: ‘help’ for help on commands
‘man’ to read the manual
‘quit’ to quit the shell

Operating system: Windows Server 2012 R2 Standard
/dev/sda1 mounted on /

><fs> mv /Windows/System32/sethc.exe /Windows/System32/sethc.exe.bak
><fs> cp /Windows/System32/cmd.exe /Windows/System32/sethc.exe
><fs> exit

After that, we need to create our virtual machine and press the “shift” key, 5 times, change the local Administrator password with the command:

net user Administrator <password>

Login with the new password.

Original post.

Cheers!

--

--

Gloria Palma González

My life is a paradigm: I can do anything. IT engineer, melomaniac, in love: #Infrastructure #OpenSource #CommunityLeadershipTeams #SoftwareEngineering