February 21, 2006 at 8:40 am
Hi
How do I find "sql server service and sql server agent are running under which account"?
Thanks for the help
February 21, 2006 at 8:57 am
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
February 21, 2006 at 9:00 am
Programs --> Administrative Tools --> Services
February 21, 2006 at 9:48 am
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
February 21, 2006 at 10:04 am
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
February 21, 2006 at 10:07 am
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