locked
SQL Agent Domain Account Script RRS feed

  • Question

  • Hi All,

     

    I am wondering if there is a query I can run to determine the existing SQL Server agent account used by SQL Server Agent -- output to a csv -- then, run a second script to set it to a newly created, and designated domain user account.

     

    Is this possible?


    Thanks, Chase
    Monday, October 10, 2011 1:40 PM

Answers

  • Hi,

    The code to display the service account (1st script) is:

    DECLARE @serviceaccount varchar(100)
    
    
    set @Serviceaccount =''
    
    EXECUTE master.dbo.xp_instance_regread
    N'HKEY_LOCAL_MACHINE',
    N'SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT',
    N'ObjectName',
    @ServiceAccount OUTPUT,
    N'no_output'
    
    SELECT @Serviceaccount as SQLAgent_ServiceAccount
    

     

    Here is a post to change the service account credentials (the 2nd script) http://www.simple-talk.com/sql/database-administration/changing-service-credentials/


    Peter Carter http://sqlserverdownanddirty.blogspot.com/
    • Proposed as answer by Peja Tao Wednesday, October 12, 2011 8:39 AM
    • Marked as answer by Chase Legend Friday, October 14, 2011 6:50 PM
    Monday, October 10, 2011 3:12 PM