|
From: Sammy on 23 Jul 2008 07:44 Does anyone know how I can programtically get all the Sql server service accounts mainly just the sql server service and agent service for my auditing so I don't have to log onto to every server to find out? I have had a good look and can't find it in any of the sql tables Thanks for any help Sammy
From: Uri Dimant on 23 Jul 2008 08:21 Sammy That is not exactly what you wanted , but you can start from it 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 "Sammy" <Sammy(a)discussions.microsoft.com> wrote in message news:EA5B6AF4-9ECA-42F6-9E25-1CA310D64964(a)microsoft.com... > Does anyone know how I can programtically get all the Sql server service > accounts mainly just the sql server service and agent service > for my auditing so I don't have to log onto to every server to find out? > I have had a good look and can't find it in any of the sql tables > > Thanks for any help > > Sammy
From: vinu on 23 Jul 2008 08:24 Sammy using t-sql --SQL Serer DECLARE @test varchar(20) EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SYSTEM\CurrentControlSet\Services\MSSQLSERVER', @value_name='ObjectName', @value=(a)test OUTPUT SELECT @test --Agent DECLARE @test varchar(20) EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT', @value_name='ObjectName', @value=(a)test OUTPUT SELECT @test If you want to do it from any programming language then. you need to use registray manupulation functions that programming tool support and read those key vinu "Sammy" <Sammy(a)discussions.microsoft.com> wrote in message news:EA5B6AF4-9ECA-42F6-9E25-1CA310D64964(a)microsoft.com... > Does anyone know how I can programtically get all the Sql server service > accounts mainly just the sql server service and agent service > for my auditing so I don't have to log onto to every server to find out? > I have had a good look and can't find it in any of the sql tables > > Thanks for any help > > Sammy
From: Eric Russell on 23 Jul 2008 15:44 Just tossing this out there, but would at least the names of these accounts possibly be contained in Active Directory anywhere? I've never had a need for it, but you can query AD just like any other remote server via openquery() or openrowset(). http://articles.techrepublic.com.com/5100-22_11-5259887.html Examples of querying the Active Directory: ========================================== -- Modify the following queries to point to an OU in your Active Directory hierarchy -- Add a linked server for the Active Directory exec sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADsDSOObject', 'adsdatasource' -- Query for a list of Contact entries in an OU using the LDAP query dialect select convert(varchar(50), [Name]) as FullName, convert(varchar(50), Title) as Title from openquery(ADSI, '<LDAP://OU=Directors,OU=Atlanta,OU=Intellinet,DC=vizability,DC=intellinet,DC=com>; (objectClass=Contact);Name,Title;subtree') -- Query for a list of User entries in an OU using the SQL query dialect select convert(varchar(50), [Name]) as FullName, convert(varchar(50), Title) as Title, convert(varchar(50), TelephoneNumber) as PhoneNumber from openquery(ADSI, 'select Name, Title, TelephoneNumber from ''LDAP://OU=Directors,OU=Atlanta,OU=Intellinet,DC=vizability,DC=intellinet,DC=com'' where objectClass = ''User''') -- Query for a list of Group entries in an OU using the SQL query dialect select convert(varchar(50), [Name]) as GroupName, convert(varchar(50), [Description]) GroupDescription from openquery(ADSI, 'select Name, Description from ''LDAP://OU=VizAbility Groups,DC=vizability,DC=intellinet,DC=com'' where objectClass = ''Group''') "Sammy" wrote: > Does anyone know how I can programtically get all the Sql server service > accounts mainly just the sql server service and agent service > for my auditing so I don't have to log onto to every server to find out? > I have had a good look and can't find it in any of the sql tables > > Thanks for any help > > Sammy
From: Sammy on 29 Jul 2008 13:29 Thanks Guys I have a working prototype now "Eric Russell" wrote: > Just tossing this out there, but would at least the names of these accounts > possibly be contained in Active Directory anywhere? I've never had a need for > it, but you can query AD just like any other remote server via openquery() or > openrowset(). > > http://articles.techrepublic.com.com/5100-22_11-5259887.html > > Examples of querying the Active Directory: > ========================================== > > -- Modify the following queries to point to an OU in your Active Directory > hierarchy > > -- Add a linked server for the Active Directory > exec sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', > 'ADsDSOObject', 'adsdatasource' > > -- Query for a list of Contact entries in an OU using the LDAP query dialect > select convert(varchar(50), [Name]) as FullName, > convert(varchar(50), Title) as Title > from openquery(ADSI, > > '<LDAP://OU=Directors,OU=Atlanta,OU=Intellinet,DC=vizability,DC=intellinet,DC=com>; > (objectClass=Contact);Name,Title;subtree') > > -- Query for a list of User entries in an OU using the SQL query dialect > select convert(varchar(50), [Name]) as FullName, > convert(varchar(50), Title) as Title, > convert(varchar(50), TelephoneNumber) as PhoneNumber > from openquery(ADSI, > 'select Name, Title, TelephoneNumber > > from ''LDAP://OU=Directors,OU=Atlanta,OU=Intellinet,DC=vizability,DC=intellinet,DC=com'' > where objectClass = ''User''') > > -- Query for a list of Group entries in an OU using the SQL query dialect > select convert(varchar(50), [Name]) as GroupName, > convert(varchar(50), [Description]) GroupDescription > from openquery(ADSI, > 'select Name, Description > from ''LDAP://OU=VizAbility Groups,DC=vizability,DC=intellinet,DC=com'' > where objectClass = ''Group''') > > > "Sammy" wrote: > > > Does anyone know how I can programtically get all the Sql server service > > accounts mainly just the sql server service and agent service > > for my auditing so I don't have to log onto to every server to find out? > > I have had a good look and can't find it in any of the sql tables > > > > Thanks for any help > > > > Sammy
|
Pages: 1 Prev: Assigning to two operators Next: what's it mean: Remote tables are not updatable... |