SQL Agent account in DMV?

  • Does anyone know if there's either a system table or DMV that you can run that shows you the basic configuration information for a SQL Instance? I'm mainly trying to find out the name of the account that SQL and SQL Agent, etc., are running under by just executing a script.

  • select * from sys.configurations

    Are you looking for the account running the SQL and SQL Agent Service?

  • DECLARE @serviceaccount varchar(100)

    EXECUTE master.dbo.xp_instance_regread

    N'HKEY_LOCAL_MACHINE',

    N'SYSTEM\CurrentControlSet\Services\MSSQLSERVER',

    N'ObjectName',

    @ServiceAccount OUTPUT,

    N'no_output'

    SELECT @Serviceaccount

  • Yeah, that last script was exactly what I was looking for! Thanks, Jason! I appreciate it!

Viewing 4 posts - 1 through 3 (of 3 total)

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