SelectEtoile : Base de connaissance SGBD

Posts Tagged 'compte'

Trouver le compte de service d'une instance MSSQL

DECLARE @ServiceaccountName varchar(250)
DECLARE @CurrentSet varchar(250)
if @@SERVICENAME = 'MSSQLSERVER'
select @CurrentSet = 'SYSTEM\CurrentControlSet\Services\'+@@SERVICENAME
else
select @CurrentSet = 'SYSTEM\CurrentControlSet\Services\MSSQL$'+@@SERVICENAME
EXECUTE master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
@CurrentSet,
N'ObjectName',
@ServiceAccountName OUTPUT,
N'no_output'
 
SELECT @@servername + ' - ' + @ServiceaccountName