Sql Server Service account and sql agent account

  •  Is there any system function or XP to find the Sql Server Service account and sql agent account in query analyser instead of going to Enterprise Manager ?

    Thanks

  • You can do it by using xp_cmdshell to execute a reg query or execute a wmi script (if you need examples see technet)

    In the resgisty you need to query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\objectname

    This will be the account its running under and the same but SQLSErveragent for the agent.

    Not sure why you want to do this but

    hth

    David

  • Thanks.., here is the exact commands

    EXEC MASTER.DBO.XP_REGREAD

    @rootkey='HKEY_LOCAL_MACHINE'

    ,@key='SYSTEM\ControlSet001\Services\MSSQLSERVER'

    ,@ValueName = 'ObjectName'

    EXEC MASTER.DBO.XP_REGREAD

    @rootkey='HKEY_LOCAL_MACHINE'

    ,@key='SYSTEM\ControlSet001\Services\SQLSERVERAGENT'

    ,@ValueName = 'ObjectName'

    We are auditing our servers and want to see whether all our servers are using the right domain acct for both of these services.

     

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

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