There are many blog posts talking about, how to recover “SysAdmin” password in case if it’s lost OR the server is new to you and no idea that has own and access to it. In my case the second option J
In my opinion, it’s very easy to work on GUI instead of command line CMD 🙂 I used a SSMS.
1. Stop the SQL server agent
2. Take the SQL server in single user mode, earlier version, it’s a bit hard
All programs –> SQL server 2012 –> Configuration Tools –> SQL server configuration manager
Stop the agent and take the SQL server into single user mode.
3. Reboot the SQL service
4. Launch the SSMS and don’t click the connect button, you need to cancel it and then click the “New query” window on top of the SSMS and then connect.
If you click the connect button the object explorer will take one connection, Single user mode will allow only one connection. Because of that we need to cancel and click the new query window.
Note: You need to be an OS administrator.
5. Create a new login and add as an admin
CREATE LOGIN XXX WITH PASSWORD=Complex password' SP_ADDSRVROLEMEMBER XXX,'SYSADMIN'
Hope this would help someone.