banshee/windows-collection/windows/ssh/
sessions
The sessions open on a Windows, in use and disconnected, by SSH and PowerShell
par banshee1 installation2 versions
v2Dernière
Publiée le 28 octobre 2026. One naming convention across collections; documentation completed.
Sessions of a Windows, by SSH
Returns the number of sessions open on a Windows: those in use, at the console as by Remote Desktop, and those left disconnected, which keep their programs and their memory. Two watches are proposed, both unchecked: what is normal depends on the server, a jump host or a server without sessions.
Versions
Windows Server 2012 and later, Windows 8 and later: Windows PowerShell 3.0, which the collector needs, ships with each of them; the OpenSSH server is built in from Windows Server 2019 and Windows 10 1809, installed from Win32-OpenSSH before. Generic: no folder of version. That every release answers alike, and serves the class read under the same name, is assumed, not yet checked on a real Windows.
How it works
The collector runs one PowerShell command that reads the counters of the Terminal Services object:
powershell -NoProfile -NonInteractive -Command "Get-CimInstance Win32_PerfRawData_LocalSessionManager_TerminalServices | Select-Object ActiveSessions, InactiveSessions | ConvertTo-Json -Compress" ActiveSessionscounts the sessions in use,InactiveSessionsthe disconnected ones; the open sessions are both together.- The names of the class and its counters are English whatever the language of Windows, where the output of
quseris translated. - Nothing is skipped at the first run: they are counts, not counters.
- An answer that is not the expected JSON stops the collector as misconfigured: a count of zero is never returned for a class that did not answer.
Nothing is written to the Windows: the command only reads.
Prerequisites
- The OpenSSH server of Windows, installed and started: - on Windows Server 2019 and later, Windows 10 (version 1809 and later) and Windows 11, where it is built in: the optional feature "OpenSSH Server" (Settings, Optional features; or
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0in PowerShell), then the servicesshdstarted and set to start automatically; - on Windows Server 2012, 2012 R2 and 2016, Windows 8, 8.1 and the earlier Windows 10, where it is not built in: OpenSSH for Windows installed from its Microsoft release (Win32-OpenSSH), then the servicesshdstarted and set to start automatically. - The default shell of the OpenSSH server left at
cmd.exe, as it is installed: the collector starts PowerShell itself, and a command meant forcmd.exewould be read differently by a PowerShell default shell. - Windows PowerShell 3.0 or later, as shipped with every Windows from Server 2012 and Windows 8 on (3.0 on Server 2012, 4.0 on 2012 R2, 5.1 from 2016 on).
- An account for monitoring, without administrator rights, member of the local groups "Performance Monitor Users" and "Event Log Readers", so that the performance counters and the System log are not refused to it. banshee reads it in
protocol:ssh:user, with its password inprotocol:ssh:passwordor its key inprotocol:ssh:private-key(the public key then inC:\Users\<account>.ssh\authorized_keys). - The fingerprint of the server's host key, set in
protocol:ssh:fingerprint(on the server,C:\ProgramData\ssh\ssh_host_ed25519_key.pub); not needed when the Security settings trust the first SSH fingerprint presented. - The Windows firewall open to the poller on TCP 22 (the rule "OpenSSH SSH Server (sshd)", created with the feature).
Outputs
| Name | Label | Unit | Per instance |
|---|---|---|---|
sessions | Open sessions | — | no |
active | Sessions in use | — | no |
disconnected | Disconnected sessions | — | no |
Watches
| Name | Title | Kind | Defaults | Checked by default |
|---|---|---|---|---|
too-many | Too many open sessions | above a threshold, on sessions | no threshold: to set on the probe | no |
disconnected | Disconnected sessions left open | above a threshold, on disconnected | no threshold: to set on the probe | no |
Limits
- Only the numbers are served: neither the names of the users nor the age of their sessions.
- Not yet checked on a real Windows: the name of the class on each version of Windows, and which sessions it counts, the session of the services (session 0), the console without anyone logged on and the SSH sessions, the collector's own among them.