Samples SQL Server utilization over multiple intervals using four DMV queries per sample: CPU (via ring buffer XML), memory (dm_os_process_memory + dm_os_sys_memory), runnable/active threads (dm_os_workers), and plan cache stats (dm_exec_query_stats). Aggregates Min/Max/Avg and outputs TXT, CSV, and an inline dark-theme HTML report.
Execution Flow
Synopsis
Takes $SampleCount snapshots spaced $SampleIntervalSeconds apart. Each snapshot fires four Invoke-DbaQuery calls concurrently. CPU is read from the ring buffer XML (dm_os_ring_buffers) rather than the OS — this yields SQL Server's own CPU view. After all samples are collected, the function aggregates Current/Min/Max/Avg for each metric and generates three output files. The HTML report embeds inline dark-theme CSS.
Requires dbatools. Default of 6 samples × 10 s = roughly 60 s total runtime. The CSV export contains raw per-sample rows; the TXT and HTML contain the aggregated summary. Output path defaults to Get-sqmDefaultOutputPath.