Hi Everyone.
I have 150 SQL servers (2000 MSDE). They all run using various domain accounts as their service logins. Is there an automated way to find out those service logins? Maybe a query I could run on each server?
I really do not want to go to each of those 150 servers and look at their properties manualy! :S
Any help would be greatly appreciated! Thank you.Something around the master.dbo.sysusers and/or master.dbo.syslogins
table(s) ?|||I think that you want the startname value from this (http://www.microsoft.com/technet/scriptcenter/scripts/os/services/ossvvb08.mspx) script.
-PatP|||I think that you want the startname value from this (http://www.microsoft.com/technet/scriptcenter/scripts/os/services/ossvvb08.mspx) script.
-PatP
Yeah, I would think that WMI would be your best bet. Dump the list of servers into a text file (or XML). Open that file using the File system object and spin through (using oFile.ReadLine). Then feed the string value (the computer name) into a function that returns the name of of the service account you are looking for. Dump that into a separate text file (or a database).
Regards,
hmscott|||Thank you everyone for responding. I got an answer at experts-exchange. The following query will return the service account:
declare @.rc int,
@.dir nvarchar(4000)
exec @.rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'System\CurrentControlSet\S ervices\MSSQLServer\',N'ObjectName', @.dir output, 'no_output'
select @.dir
I've modified it put the result in the central table and then ran it through a SQL loop. Worked perfectly! :D
WMI would have worked as well, but this solution took just 10 min to implement.
P.S. Had no idea that something like xp_instance_regread existed. Is too much to hope that sql server 2005 will have better documentation? :-)|||That Transact-SQL code will work nicely as long as you only need the default instance of SQL 2000.
-PatP|||That Transact-SQL code will work nicely as long as you only need the default instance of SQL 2000.
-PatP
Good point, Pat. For named instances the command will need to be modified:
declare @.rc int,
@.dir nvarchar(4000)
exec @.rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'System\CurrentControlSet\S ervices\MSSQL$Your_Instance_Name\',N'ObjectName', @.dir output, 'no_output'
select @.dir
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment