From a3d63235eed81761071f2e60d982aab2c7a8f2b5 Mon Sep 17 00:00:00 2001 From: Tisit Date: Tue, 1 Oct 2024 23:45:25 +0200 Subject: [PATCH] sp_Blitz: Fix checks 73 to work with sysadmin permissions --- sp_Blitz.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sp_Blitz.sql b/sp_Blitz.sql index ad92d53a..a5f415ee 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -334,18 +334,15 @@ AS END CATCH; END; /*Need execute on sp_validatelogins*/ - IF ISNULL(@SkipGetAlertInfo, 0) != 1 /*If @SkipGetAlertInfo hasn't been set to 1 by the caller*/ - BEGIN - BEGIN TRY - /* Try to fill the table for check 73 */ - INSERT INTO #AlertInfo - EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; - - SET @SkipGetAlertInfo = 0; /*We can execute sp_MSgetalertinfo*/ - END TRY - BEGIN CATCH - SET @SkipGetAlertInfo = 1; /*We have don't have execute rights or sp_MSgetalertinfo throws an error so skip it*/ - END CATCH; + IF NOT EXISTS + ( + SELECT + 1/0 + FROM fn_my_permissions(N'[master].[dbo].[sp_MSgetalertinfo]', N'OBJECT') AS fmp + WHERE fmp.permission_name = N'EXECUTE' + ) + BEGIN + SET @SkipGetAlertInfo = 1; END; /*Need execute on sp_MSgetalertinfo*/ IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/ @@ -8467,6 +8464,9 @@ IF @ProductVersionMajor >= 10 BEGIN IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 73) WITH NOWAIT; + + INSERT INTO #AlertInfo + EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; INSERT INTO #BlitzResults ( CheckID ,