Friday, March 29, 2024

Reset SA user / Recover access to a SQL Server instance

Problem: You need to access a Microsoft SQL Server instance, but you have forgotten the SA password and/or the account is disabled (e.g. per default in Microsoft SQL Express). A 2nd administrator account isnĀ“t created and you do now have the rights, to create one with one of the already existing accounts.

Solution: The internet list many solutions here, some will cause a downtime and the other ones might break the complete SQL Environment very easy. But thanks to Sysinternals there is an very easy way to change the SA password and or enable an already existing SA (you can also add a new administrator account via that way if you need). The steps are quite simple:

1.) Open a RDP Connection to the SQL Server (You need administrator rights)

2.) Download PsExec and store that on the SQL Server (e.g. C:\Temp)

3.) Now run a CMD as administrator and switch to the tempfolder (or the folder where you stored PsExec)

cd C:\temp

4.) Here komms the trick now. We will run PsExec as the system account (-s) and start the SSMS (= Microsoft SQL Server Management Studio) interactively (-i).

PsExec -s -i "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

If this is the first time you use PSexec on the Server you are asked to accept the license

5.) You will then be able to authenticate against SSMS via AUTHORITY\SYSTEM. You can then browse for the SQL Servers, select the correct one from the list and click on connect. After that you can change the accounts as needed.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

35FollowersFollow
- Advertisement -

Latest Articles