March 23, 2010 at 10:34 am
Hi,
I need to make a script that deletes all the users (windows users) from a SQL Server 2005 instance if they are not the users that are running the SQL Server Service or the SQL Server Agent Service or the browser service or any other SQL Server service.
How can i see (by t-sql) wich are the user accounts that are running SQL Server 2005 services?
Thank you
March 23, 2010 at 11:17 am
This is from SQL2000 (default instance) but should work in 2005 as well
declare @account varchar(50)
print 'MSSQLServer service account '
exec xp_regread 'HKEY_LOCAL_MACHINE', 'SYSTEM\CurrentControlSet\Services\MSSQLServer', 'Objectname', @account output
print @account
print 'SQLServerAgent service account '
exec xp_regread 'HKEY_LOCAL_MACHINE', 'SYSTEM\CurrentControlSet\Services\SQLServerAgent', 'Objectname', @account output
print @account
---------------------------------------------------------------------
March 23, 2010 at 11:20 am
thank you very much i will try that.
What about the other services like SQL Server Browser and others?
March 29, 2010 at 10:34 am
thank you very much i will try that.
What about the other services like SQL Server Browser and others?
March 29, 2010 at 10:44 am
same place, different entry?
---------------------------------------------------------------------
March 29, 2010 at 10:46 am
ups.... lol thank you 🙂
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply