SQLDMO to List SQL Server Configs

The SQLDMO Script below will list all of the SQL Server configuration options and their config_value and run_value just as per the sp_configure Stored Procedure:

Dim oSQLServer
Dim cv
Set oSQLServer = CreateObject(“SQLDMO.SQLServer”)

oSQLServer.LoginSecure = True
oSQLServer.Connect “(local)”

With oSQLServer.Configuration
.ShowAdvancedOptions = True
For Each cv In .ConfigValues
Msgbox cv.Name & “, ” & cv.RunningValue & “, ” & cv.CurrentValue
Next
End With

oSQLServer.DisConnect
Set oSQLServer = Nothing