Changing SQL server and Agent accounts

  • I would like to change the service accounts on several SQL servers, and its not practical for me to use Enterprise Manager. Is there a script I can run that will change the accounts and restart the services?

    Thanks...Nali

  • Make sure you test this in a test environment!!!

    You could attempt this from a batch file using sc commands

    http://technet2.microsoft.com/WindowsServer/f/?en/Library/0a658e97-51d5-4109-b461-a474c799964e1033.mspx

    something like this

    SC [\\SERVERNAME] stop [servicename]

    SC config [servicename] obj=[acountname] password=[pswd]

    SC [\\SERVERNAME] start [servicename]

    Also see KB article http://support.microsoft.com/kb/283811/en-us to verify you have all of the other permissions set etc

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Just be prepared to change any of them back.  I changed startup accounts on one particular server and the clients were unable to connect with ODBC unless the connection properties were changed from TCP/IP to Named Pipes (or vice-versa, can't recall which way).  Anyway, the client ODBC DSNs were locked down and there were hundreds of them, so the easiest fix was to change back to the original account.  I guess you never know what will happen until afterward 🙂

  • If you choose this method you may have issues with SP4 application. There are also some registry tweaks that are needed and done when you use EM. Prior to SP4 you could do this without ill affect.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • you are correct that's why I suggested the for Nali to look at the KB article that deals with which keys needs changed etc.  Also The do this is a test environment first bit...

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Thanks for the heads up. I was about to apply the following:

    SC stop SQLSERVERAGENT

    ping -n 11 127.0.0.1 >NUL

    SC \\localdc config SQLSERVERAGENT obj= domain\userid password= cavangar

    SC stop MSSQLSERVER

    ping -n 11 127.0.0.1 >NUL

    SC \\localdc config MSSQLSERVER obj= domain\userid password= cavangar

    SC start MSSQLSERVER

    SC start SQLSERVERAGENT

    I'm running sp3, so maybe I can get away with it....

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply