Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp_Blitz: Fix checks 73 to work with sysadmin permissions #3579

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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