Service account of a named instance from registry.

  • On SQL2008 R2, I have a default instance (MSSQLSERVER) and a named instance (APP1). I need to output service account under which the SQLServer services are running. I used the below code.

    DECLARE @svc varchar(50)

    EXECUTE master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'SYSTEM\CurrentControlSet\Services\APP1', N'ObjectName', @svc OUTPUT, N'no_output'

    SELECT @svc

    In place of APP1, if i use MSSQLSERVER, i get the correct value of service account name under which the default instance is running.

    But if i use APP1, i get NULL. Why ?

    I am running both instances under an account which is member of Local admins.

  • sometimes the things are quiet simple to check even without opening the query window.

    Follow this :-

    1) Start--run--services

    2) Right click SQL Server (Instance) services and select properties

    3) Go to "Log ON" tab

    and collect the details of service account.

    ----------
    Ashish

  • You need MSSQL$APP1.

    John

  • Super !. Thanks a lot John.

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

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