How to find on which account SQL server agent is running

  • I would like to find out the account on which sql server agent is running. We can get by right clicking sql server agent or from job history.

    But, I would be glad if you could share with me any script for the same.

    Thanks

    M&M

  • There is no way to tell which account the SQL Agent is 'configured' to run as by looking in the database. It uses whatever Windows account (local, domain or system) is configured in the services applet.

    The probability of survival is inversely proportional to the angle of arrival.

  • try this

    declare

    @account varchar(50)

    exec xp_regread 'HKEY_LOCAL_MACHINE', 'SYSTEM\CurrentControlSet\Services\SQLServerAgent', 'Objectname', @account output

    print @account

    ---------------------------------------------------------------------

  • Alternative method

    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

    Same principle

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Not a script, but you can always go to the windows services and look for it there. SQL Server Agent is the service name, I believe.

  • Thank you All

    This was really helpful

    M&M

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

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