Skip to content

Commit 6a2a133

Browse files
Added @UsualOwnerOfJobs to be used in CheckID 6 Jobs Owned By Users
to set your default SA user. I did not use @UsualDBOwner you do not have these the same. Amend
1 parent 469fe65 commit 6a2a133

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sp_Blitz.sql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ ALTER PROCEDURE [dbo].[sp_Blitz]
2626
@SummaryMode TINYINT = 0 ,
2727
@BringThePain TINYINT = 0 ,
2828
@UsualDBOwner sysname = NULL ,
29+
@UsualOwnerOfJobs sysname = NULL , -- This is to set the owner of Jobs is you have a different account than SA that you use as Default
2930
@SkipBlockingChecks TINYINT = 1 ,
3031
@Debug TINYINT = 0 ,
3132
@Version VARCHAR(30) = NULL OUTPUT,
@@ -1932,7 +1933,11 @@ AS
19321933
BEGIN
19331934

19341935
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 6) WITH NOWAIT;
1936+
19351937

1938+
IF @UsualOwnerOfJobs IS NULL
1939+
SET @UsualOwnerOfJobs = SUSER_SNAME(0x01);
1940+
19361941
INSERT INTO #BlitzResults
19371942
( CheckID ,
19381943
Priority ,
@@ -1951,7 +1956,7 @@ AS
19511956
+ '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details
19521957
FROM msdb.dbo.sysjobs j
19531958
WHERE j.enabled = 1
1954-
AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01);
1959+
AND SUSER_SNAME(j.owner_sid) <> @UsualOwnerOfJobs;
19551960
END;
19561961

19571962
/* --TOURSTOP06-- */

0 commit comments

Comments
 (0)