Collaboration-2-Go


Lösungen und Software-Entwicklung im Collaboration Umfeld, insbesondere Microsoft SharePoint, Microsoft Exchange und Microsoft Office.

Support


Mobil: +49 (152) 53 97 78 79
Mail: service@collaboration-2-go.de
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln



SQL Server Access as a local Administrator
Created: 03.09.2012
Categories: SQL Server

      In case you have lost your passwords for all your SQL Server accounts here
      is a way that works in SQL Server 2008 R2 to get access:
      
      1.) Write a batch file:
      
        sqlcmd -Q "CREATE LOGIN [domain\user] from windows"
        sqlcmd -Q "EXEC sys.sp_addsrvrolemember
           @loginame = N'domain\user', @rolename = N'sysadmin'"
      

      2.) Replace values for domain\user as appropriate, remove linebreak in 2nd sqlcmd
      3.) Add this Script to your scheduled tasks
      4.) Run scheduled task as SYSTEM
      5.) Wait and see

      It shouldn't work in SQL Server 2012 anymore.
    

Send us a Comment!