Performs a comprehensive best-practice audit of a SQL Server instance covering MAXDOP, Max Server Memory, Cost Threshold for Parallelism, xp_cmdshell, SA account, sysadmin count, CLR, SQL XPs, TempDB configuration, collation, and SQL Server version. Returns one result row per check with Status OK / Warning / Failed / Info / Error.
Execution Flow
Synopsis
Connects via dbatools and runs up to 11 best-practice checks (13 with -Detailed). Each check produces a [PSCustomObject] with a human-readable Message and a Status of OK, Warning, Failed, Info, or Error. The Max Server Memory check uses the same logic as Test-sqmMaxMemory (85%/90%/95% thresholds). MAXDOP recommendation scales with core count: up to 4 cores → core count; 5–8 → 4; 9–16 → 8; >16 → 16.
Requires dbatools. No file output — results are returned as objects only. Pipe to Format-Table or Out-GridView for quick review. Use -Detailed to add autogrow, backup directory, and per-database collation checks.
Check Summary
Check
Threshold / Recommendation
Status values
MAXDOP
2..min(cores,16); =0 → Warning; =1 → Failed
OK
/
Warning
/
Failed
Max Server Memory
85%–95% of physical RAM; default value (2147483647) → Warning
Enable additional checks: autogrow settings per user DB, backup directory existence, per-database collation vs. instance collation.
-EnableException
Switch
false
Throw terminating exceptions instead of appending an Error row.
Return Value (per row)
Property
Description
Check
Check name (e.g. MAXDOP, SA Account).
CurrentValue
Observed value on the instance.
Recommended
Best-practice recommendation string.
Status
OK / Warning / Failed / Info / Error.
Message
Human-readable explanation.
Examples
# Standard check on local instanceGet-sqmSQLInstanceCheck | Format-Table-AutoSize# Detailed check on named instanceGet-sqmSQLInstanceCheck-SqlInstance"SQL01\PROD"-Detailed# Show only failed/warning checksGet-sqmSQLInstanceCheck | Where-Object { $_.Status-in'Failed','Warning' }