Ideally, I would like to pass a SQL Server instance name (for instance, .\SQLEXPRESS
) and get the name (or a SID) of the account that particular instance is running as. Something like this:
var serviceAccount = SomeClass.GetServiceAccount(".\SQLEXPRESS");
Maybe this info is stored somewhere in system registry or other well-known location? Any ideas?