With SQL Server versions 2008R2 and 2012, you can access the registry to get the settings for the current instance of SQL Server.  Here is how it works using the dynamic management view (DMV) called dm_server_registry. From there you get get at all sorts of information about the current SQL Server instance.  Give dm_server_registry a try.

One of the new Dynamic Management Views introduced in SQL Server 2012 is the dm_server_services which returns info on the services running that are associated with SQL Server. select * from sys.dm_server_services;   Give it a try.   Looking this over, the first thing that comes to mind is to to use this to be able to detect if the SQL Server Agent Process is …

New DMV in SQL Server 2012 sys.dm_server_services Read more »