I have a working SQL Server instance to administer. I do not have a SQL Server login and do not know any other logins. I do have a Windows domain login to the server as a local admin. How can I add my Windows account as a login to SQL Server when I don't know any existing login to the instance?
I can connect using PowerShell:
but cannot retrieve any detail:
gci SQL Server PowerShell provider error: Failed to read child items. [Failed to connect to server uk-blahblah. --> Login failed for user 'AUTOdomain\admin-account'.]
I can stop the SQL Service and restart from an elevated command prompt:
sqlservr.exe -m -c
but trying to run sqlcmd still fails:
sqlcmd -S UK-blahblah Login failed for user 'AUTOdomain\admin-account'
I'm sure many of you must have found a way of adding your login to a server where you don't know any other logins, but I'm struggling a little here.
I'm using SQL Server 2012 SP2 Enterprise Edition.