To reset a lost Windows server 2012 passwrd there are a few things that you can do, all is not lost. You will need to have physical access to the machine to boot a from a cd or usb drive this will also work for a virtual machine if you have some form of console access and have the ability to mount and boot the required media.
To reset the password on your Windows 2012 server, follow one of the steps below, I should also point our that this may work with many other versions of windows, before performaing any of the below I would advise checking on your backups to make sure you have a backup of your data in the event that you do need to restore the server to a previouse state or reinstall in the event that perminant damage is caused, not that anything should go wrong here as the changes should not cause any major changes.
Using A Windows Server DVD
To start the process for resetting your Windows Server password you will need to boot from your Windows Server install media.
After booting from the Windows media at the Windows Setup menu select Next then Select Repair your computer.
From Choose and option, select Troubleshoot.
From Advanced options, select Command Prompt.
From the command prompt we will now need to make a backup copy or rename Utilman.exe
and replace it with cmd.exe
cd windows\system32
ren Utilman.exe Utilman.exe.backup
copy cmd.exe Utilman.exe
Exit and close the command prompt and select Continue and boot to the login prompt, at the login prompt select Windows Key + U or ctrl + esc + u if you don't have a windows key, this should load a command prompt, you may need to select the accessability button.
At the command prompt you can now reset the administrator password, type net user administrator Your-New-Password
This will have now reset your administrator password and allow you to login, once logged in your will want to restore your files by removing the Utilman.exe and restoring the original Utilman.exe.backup as Utilman.exe.
Using A Linux Live CD
I have recently done this using an Ubuntu Live CD as I did not have access to the Windows media at the time, the process is much the same as with the Windows Media.
To do this with Ubuntu make your Live CD or USB, not going to cover how to make that here but you may want to have a look at https://www.pendrivelinux.com/ and the YUMI – Multiboot USB Creator
Once you have booted into the Live CD and selected try Ubuntu open up the disks tool from there you should then be able to view the physical disk and mount it.
After mounting the disk/windows partition (in my case this was Filesystem Partition 2), open the mouted disk/partition with the files application, navigate to windows/system32
From the system32 folder search for Utilman.exe and rename to something different like Utilman.exe.backup
Once you have renamed Utilman.exe search for cmd.exe and make a copy of the file and then rename to Utilman.exe and make sure this is in the system32 folder.
After making the changes reboot into windows as normal, after you get to the login prompt click the Windows Key + U if you don't have a windows key the ctrl + esc + u should also do the same,
you should now have a command prompt where you can reset the password, type net user administrator Your-New-Password
This will have now reset your administrator password and allow you to login, once logged in your will want to restore your files by removing the Utilman.exe and restoring the original Utilman.exe.backup as Utilman.exe.
Hope this has helped you in getting back into your machine.