Skip to content

Commit 7715760

Browse files
committed
determine German OS for xp_cmdshell call Check 260 and 261
this commit adresses issue 3673 where the "net localgroups administrators" command will not return the proper information since the naming is different in an German OS
1 parent f712b79 commit 7715760

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sp_Blitz.sql

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9939,8 +9939,17 @@ 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 #localadminsag
9943-
EXEC /**/xp_cmdshell/**/ N'net localgroup administrators' /* added comments around command since some firewalls block this string TL 20210221 */
9942+
/* language specific call of xp cmdshell */
9943+
IF (SELECT os_language_version FROM sys.dm_os_windows_info) = 1031 /* os language code for German. Again, this is a very specific fix, see #3673 */
9944+
BEGIN
9945+
INSERT INTO #localadminsag
9946+
EXEC /**/xp_cmdshell/**/ N'net localgroup Administratoren' /* german */
9947+
END
9948+
ELSE
9949+
BEGIN
9950+
INSERT INTO #localadminsag
9951+
EXEC /**/xp_cmdshell/**/ N'net localgroup administrators' /* added comments around command since some firewalls block this string TL 20210221 */
9952+
END
99449953

99459954
IF EXISTS (SELECT 1
99469955
FROM #localadminsag

0 commit comments

Comments
 (0)