· Uwe Janke
Commands / Show-sqmWhoIsActiveMonitor

Show-sqmWhoIsActiveMonitor

Session ManagementsqmSQLTool v1.9.129+ · Show🔓 VIEW SERVER STATE
The live view of Get-sqmWhoIsActive: a WinForms dialog that shows the sessions in a grid which refreshes itself, instead of console output plus files at the end. Start begins a run, a timer fetches a snapshot on the configured interval and overwrites the grid with the newest one, so the grid always shows the current state rather than growing for hours. Stop (or closing the window while a run is active) ends the timer and writes exactly what Get-sqmWhoIsActive writes: a CSV with every iteration of the run, plus an HTML report containing only the last snapshot. Query and report logic are shared with Get-sqmWhoIsActive through the same private helpers (Get-sqmWhoIsActiveSnapshot / Export-sqmWhoIsActiveReport), so this dialog is purely an alternative view of identical data. It runs synchronously in the current runspace, no background jobs: each timer tick executes the DMV query on the UI thread, which is not noticeable in practice because the queries are light.

Parameters

ParameterTypeRequiredDefaultNotes
-SqlInstancestringOptional$env:COMPUTERNAMEPre-fills the instance field when the dialog opens.
-SqlCredentialPSCredentialOptional, Optional credential. Without it: Windows authentication.
-RepeatIntervalSecondsint (1-3600)Optional5Pre-fills the interval field. Can be changed in the dialog before starting a run.
-OutputPathstringOptionalGet-sqmDefaultOutputPath\WhoIsActiveDirectory for the CSV/HTML written on Stop. Same folder as Get-sqmWhoIsActive.

Execution Flow

START Open the WinForms dialog Instance, interval and session filter are pre-filled and editable User presses Start? NO Close without a run No snapshot, no report file YES Timer tick: Get-sqmWhoIsActiveSnapshot Runs on the UI thread every N seconds - the same DMV query Get-sqmWhoIsActive uses Overwrite the grid with the newest snapshot Grid always shows the current state; every iteration is kept for the CSV Blocked sessions and long runners are colour-coded Stop pressed or window closed? NO Keep ticking Back to the next timer tick YES Export-sqmWhoIsActiveReport CSV with all iterations of the run + HTML with only the last snapshot DONE

Examples

Open the live monitor for one instance
Show-sqmWhoIsActiveMonitor -SqlInstance "SQL01"
Start with a 2-second refresh interval
Show-sqmWhoIsActiveMonitor -SqlInstance "SQL01" -RepeatIntervalSeconds 2
Write the reports to a share instead of the default folder
Show-sqmWhoIsActiveMonitor -SqlInstance "SQL01" -OutputPath "\\fileserver\dba$\WhoIsActive"
Monitor a remote instance with SQL authentication
$cred = Get-Credential
Show-sqmWhoIsActiveMonitor -SqlInstance "SQL01" -SqlCredential $cred