This is an old revision of the document!
SQL Server
Solutions
- https://github.com/mgupton/mssql-check, Powershell solution that runs SQL scripts against all instances
Example Queries
Get Config Settings
SELECT * FROM sys.configurations
Select Into Variable
USE master; GO DECLARE @TblTmp TABLE ([name] nvarchar(100), is_disabled bit) INSERT INTO @TblTmp ([name], is_disabled) SELECT [name], is_disabled FROM sys.sql_logins WHERE principal_id = 1 SELECT * FROM @TblTmp
USE [master] GO DECLARE @IsFinding bit SET @IsFinding = 0 IF EXISTS (SELECT [name] FROM sys.databases WHERE [name] IN ('pubs', 'Northwind', 'AdventureWorks', 'WorldwideImporters')) SET @IsFinding = 1 IF @IsFinding = 1 SELECT @@SERVERNAME AS [Server Name], 'Finding' AS STATUS, 'STIG V-213954' AS reference ELSE SELECT @@SERVERNAME AS [Server Name], 'Pass' AS STATUS, 'STIG V-213954' AS reference