MSSQL Get Settings and Counters w. PowerShell
# Query Server Configuration... Invoke-Sqlcmd -Query "SELECT * FROM sys.configurations WHERE description LIKE '%server memory%'" # Server performance counter Page life expectancy (>(300s/4G))... # Server performance counter Lazy writes/sec (take 2 samples with 1s between samples)... Invoke-Sqlcmd -Query "SELECT object_name, counter_name, cntr_value from sys.dm_os_performance_counters WHERE counter_name IN ('Total Server Memory (KB)', 'Page life expectancy', 'Lazy writes/sec')"