• Sorry to dig up an old thread, but this thread was returned by Google when I was looking at getting the same information, and I have something to add to assist anyone else stumbling across this tread looking to read the AuditLevel via script.

    Use xp_instance_regread instead of xp_regread when looking for info in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer branch of the registry, it will sub in the correct instance syntax.

    DECLARE @AuditLevel int

    EXEC master..xp_instance_regread

    @rootkey='HKEY_LOCAL_MACHINE',

    @key='SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',

    @value_name='AuditLevel',

    @value=@AuditLevel OUTPUT

    SELECT @AuditLevel