opened image

How to reset a password on Windows 2019

Password Reset on Windows 2019

 

In the adjacent article "Password Reset on Windows Server 2016-2012," we have already shown you how to easily reset the password for accessing as the Administrator or any other user with access to virtual machine management. In this article, we will show you how to do it using Windows Server 2019.

 

Password Reset for Windows Server 2019

On this version of the operating system, there is a different security policy, so you cannot reset the password using the usual password recovery image. For this, we will need the SystemRescue image, and we will use the fifth version.

So, after connecting the system recovery image, we need to select the "SystemRescueCd: default boot options" item. Press the "Enter" button and wait for the system to fully load.
 

 

First, you need to mount the Windows operating system to the system recovery image. To understand which device to connect for password reset, enter the command:

fdisk -l

After that, you need to create the directory /mnt/Windows to which we will connect the device. In our case, it is vda2, but your device may be different. Usually, you need the device that has more disk space, if there are two, where the first one is the boot device and the second one is the main device.

mkdir /mnt/Windows
mount -t ntfs -o rw /dev/vda2 /mnt/Windows

 

 

Note that if you encounter the same message as in the screenshot, it means that you need to boot the Windows operating system after disconnecting the recovery image, and then shut down Windows again using the "Stop" button in the VMmanager control panel. After that, in the "Disks" tab, reconnect the recovery image to the server and start it, performing the above three commands again.

Once you have mounted the device to your server, go to the directory where the SAM file is stored. SAM is the Security Accounts Manager in the Windows operating system, which operates the user account database.

cd /mnt/Windows/Windows/System32/config/
ls -l | grep SAM

 

 

To prevent any unpleasant situations, let's make a backup of the file with the following command:

cp SAM SAM.back

To view the user accounts on the server using SAM, use the following command:

chntpw -l SAM

 

 

To perform actions with the desired user, enter the command:

chntpw -u Administrator SAM

Instead of Administrator, you can specify the user you need. From the list, select the first option "Clear (blank) user password," enter the number 1. After that, you should see the message "Password cleared," enter the letter q, and you can safely disconnect the recovery disk and boot into Windows.

 

 

 

Conclusion

This article has shown how to reset the password using the system recovery disk and the Security Accounts Manager.