Skip to content

Commit

Permalink
Merge pull request #3579 from Tisit/dev
Browse files Browse the repository at this point in the history
sp_Blitz: Fix checks 73 to work with sysadmin permissions
  • Loading branch information
BrentOzar authored Oct 14, 2024
2 parents ae935df + a3d6323 commit 8fdf5f1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions sp_Blitz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down Expand Up @@ -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 ,
Expand Down

0 comments on commit 8fdf5f1

Please sign in to comment.