Skip to content

Commit f712b79

Browse files
authored
check 261 fix temp table for "can't piggyback"
as mentioned in comment here: #3673 (comment) if the script has to "piggyback" here, it now uses the proper temp table
1 parent 2aa89ef commit f712b79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sp_Blitz.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9939,11 +9939,11 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
99399939
/*had to use a different table name because SQL Server/SSMS complains when parsing that the table still exists when it gets to the create part*/
99409940
IF OBJECT_ID('tempdb..#localadminsag') IS NOT NULL DROP TABLE #localadminsag;
99419941
CREATE TABLE #localadminsag (cmdshell_output NVARCHAR(1000));
9942-
INSERT INTO #localadmins
9942+
INSERT INTO #localadminsag
99439943
EXEC /**/xp_cmdshell/**/ N'net localgroup administrators' /* added comments around command since some firewalls block this string TL 20210221 */
99449944

99459945
IF EXISTS (SELECT 1
9946-
FROM #localadmins
9946+
FROM #localadminsag
99479947
WHERE LOWER(cmdshell_output) = ( SELECT LOWER([service_account])
99489948
FROM [sys].[dm_server_services]
99499949
WHERE [servicename] LIKE 'SQL Server%Agent%'

0 commit comments

Comments
 (0)