Find the account under which sql service and agent are running

  • Hi

    How do I find "sql server service and sql server agent are running under which account"?

    Thanks for the help

     

     

  • Administrator tools->Services->SQL Server And Agent Properties->Log on..

    Alternatively, enterprise manager->SQL Server Properties->Security and for SQL Agent....enterprise manager->Managemet->SQL Server Agent->Properties...

    -Krishnan

  • Programs --> Administrative Tools --> Services

  • Thanks Kishnan, Jimmy

    For some reason under EM -- Properties ...... "startup service account" it doesn't show me any value (and it's grayed) for both service and agent (although I have registered the server using an account that has sysadmin privileges)

    Thanks

     

  • This will read the registry and give you what you need, I got it from this site after posing the same question:

     

    declare

    @reg_srv varchar(256),

    @reg_agent varchar

    (256)

    if

    serverproperty('instancename') is null

    begin --default instance

    set @reg_srv='SYSTEM\CurrentControlSet\SERVICES\MSSQLSERVER'

    set @reg_agent='SYSTEM\CurrentControlSet\SERVICES\SQLSERVERAGENT'

    end

    else

    begin --named instance

    set @reg_srv='SYSTEM\CurrentControlSet\SERVICES\MSSQL$'+cast (serverproperty('instancename') as sysname)

    set @reg_agent='SYSTEM\CurrentControlSet\SERVICES\SQLAgent$'+cast (serverproperty('instancename') as sysname)

    end

    exec master..xp_regread

    'HKEY_LOCAL_MACHINE', @reg_srv, 'ObjectName'

    exec master..xp_regread

    'HKEY_LOCAL_MACHINE', @reg_agent, 'ObjectName'

    go

  • Thanks much Andrew, above mentioned code definitely helps.

     

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

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