To change the administrator password on a virtual machine (VM) with a Windows OS, in the VMmanager interface go to Virtual Machines → select VM →
menu → Change Password → enter the new password → click Save.
In some cases, such as OS failures, the password may not change. In this case, you can reset the password in recovery mode.
The procedures in this article require direct modification of the guest OS system files. Before proceeding, create a backup of the virtual machine (VM). For more information, see the article Creating backups manually.
Use recovery mode only if the password cannot be reset through the platform interface.
Example of resetting the password in Windows Server 2019
- Set the VM to recovery mode: Virtual machines → select the VM →
menu → Recovery mode → Start mode and reboot. - Wait until the recovery mode is started and connect to the VM via VNC or SPICE: Virtual machines → select the VM →
menu → VNC (SPICE). - After booting SystemRescueCD, mount the Windows partition:
-
Enter the command to display all partitions:
fdisk -lExample outputDevice Boot Start End Sectors Size Id Type /dev/vda1 * 2048 1230847 1228800 600M 7 HPFS/NTFS/exFAT /dev/vda2 1230848 41943039 40712192 19.4G 7 HPFS/NTFS/exFATThe Windows partition is typically the largest
HPFS/NTFS/exFATpartition. In the example above, it is/dev/vda2. -
Mount the required partition:
mount /dev/vda2 /mntComments to the command
-
-
Go to the directory with the system configuration files:
cd /mnt/Windows/System32/config/ -
isplay the list of Windows users:
chntpw -l SAMExample outputRID Username Admin? Lock? 01f4 Administrator ADMIN dis/lock 01f5 Guest - dis/lockComments -
Run the chntpw utility to reset the password:
chntpw -u 0x01f4 SAMComments to the command - If the account is locked, select option 2 — Unlock and enable user account.
- Enter "1" to reset the account password.
- Enter "q" to exit the utility and "y" to save the changes made.
-
Check the result of the utility actions:
chntpw -l SAMExample outputRID Username Admin? Lock? 01f4 Administrator ADMIN *BLANK* 01f5 Guest - dis/lock 03e8 User - dis/lockThe BLANK status for the Administrator user means that the password has been successfully reset.
-
Disable the VM's recovery mode: Virtual machines → select the VM →
menu → Recovery mode → Disable mode and reboot. - Connect to the VM via VNC or SPICE and set a new password using the OS tools.
ImportantAfter resetting the password using the procedure above, a new password can only be set from within the guest OS. The Change password option in the Virtual Machines section only works with an active account and will not apply if the password has been reset (cleared).
En
Es