Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Retrieve Service Account Login Information from t-SQL

 
   Database Help (Home) -> Programming RSS
Next:  SQL Server 2008 BI -Data Warehousing Training  
Author Message
info

External


Since: Jan 23, 2008
Posts: 29



(Msg. 1) Posted: Mon Dec 15, 2008 10:33 am
Post subject: Retrieve Service Account Login Information from t-SQL
Archived from groups: microsoft>public>sqlserver>programming (more info?)

I'm working an SSRS reporting system to give me about my servers and
one piece of information I want to gather the account used in the
"Login As" setting for the SQL Service and SQL Agent services?
Basically: What account are the 2 services running under.

Is this possible? If so, does anyone have any sample script of URL to
go to.. I search for the code and found nothing.

Thank you,

Erik

 >> Stay informed about: Retrieve Service Account Login Information from t-SQL 
Back to top
Login to vote
info

External


Since: Jan 23, 2008
Posts: 29



(Msg. 2) Posted: Tue Dec 16, 2008 9:54 am
Post subject: Re: Retrieve Service Account Login Information from t-SQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Dec 15, 12:33 pm, i... RemoveThis @onlyhd.tv wrote:
> I'm working an SSRS reporting system to give me about my servers and
> one piece of information I want to gather the account used in the
> "Login As" setting for the SQL Service and SQL Agent services?
> Basically:  What account are the 2 services running under.
>
> Is this possible?  If so, does anyone have any sample script of URL to
> go to.. I search for the code and found nothing.
>
> Thank you,
>
> Erik

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 as SQLServer_ServiceAccount

set @Serviceaccount =''

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

SELECT @Serviceaccount as SQLAgent_ServiceAccount

 >> Stay informed about: Retrieve Service Account Login Information from t-SQL 
Back to top
Login to vote
Tony Lucero

External


Since: Mar 03, 2010
Posts: 1



(Msg. 3) Posted: Wed Mar 03, 2010 8:46 am
Post subject: Whoever posted this [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Exactly what I was looking for!

You are the sexiest man/women alive, you exude nerdness.

Thanks again...



inf wrote:

Re: Retrieve Service Account Login Information from t-SQL
17-Dec-08

On Dec 15, 12:33=A0pm, i....RemoveThis@onlyhd.tv wrote:

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 as SQLServer_ServiceAccount

set @Serviceaccount =3D''

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

SELECT @Serviceaccount as SQLAgent_ServiceAccount

Previous Posts In This Thread:

On Wednesday, December 17, 2008 5:13 AM
inf wrote:

Retrieve Service Account Login Information from t-SQL
I'm working an SSRS reporting system to give me about my servers and
one piece of information I want to gather the account used in the
"Login As" setting for the SQL Service and SQL Agent services?
Basically: What account are the 2 services running under.

Is this possible? If so, does anyone have any sample script of URL to
go to.. I search for the code and found nothing.

Thank you,

Erik

On Wednesday, December 17, 2008 5:14 AM
inf wrote:

Re: Retrieve Service Account Login Information from t-SQL
On Dec 15, 12:33=A0pm, i....RemoveThis@onlyhd.tv wrote:

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 as SQLServer_ServiceAccount

set @Serviceaccount =3D''

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

SELECT @Serviceaccount as SQLAgent_ServiceAccount


Submitted via EggHeadCafe - Software Developer Portal of Choice
Join Lists with LINQ - SharePoint 2010
http://www.eggheadcafe.com/tutorials/aspnet/b0c1cd0d-fe82-444e-a16e-7d...7d38eca
 >> Stay informed about: Retrieve Service Account Login Information from t-SQL 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Change Service Account Password - Hi, I need a simple SQL-DMO or WMI code to change SQL Services account password on SQL 2000 and SQL 2005 servers. Thanks for your help.

Setting Windows Service "Local System Account" on Setup - Hello, I need a command which sets windows service log on account as "Local System Account" when we install SQL Server Express. Is there a command which tell the installer to set this account and is good for any local? Unfortunately, setup ...

Login failed for user 'NT AUTHORITYSYSTEM'. [CLIENT: 192.1.. - It's been suggested that I post here rather than in the windows.server.sbs WIN2003SBS Premium R2 Help! This error is appearing every one minute when SQL Server and SQL Server Agent are running (but not when not): Event Type: Failure Audit Event..

To retrieve a object - Hi all of us, I'm trying to retrieve a table which has been deleted without bearing in mind... Is possible to restore .LDF file (the most recent backup) and to have back that table Any help will be welcomed. Thanks a lot,

How can I retrieve hex string as character vs. hex? - For instance, the command: print convert(binary(11), 'Hello World') returns: 0x48656C6C6F20576F726C64 For this given hex string, how can I get a character string that is: 48656C6C6F20576F726C64 (note that the 0x has been removed from the prefix). ..
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]