Skip to content

Monitoring Windows over WinRM ​

Probeward reads Windows hosts without an agent. It sends read-only WQL queries over WinRM (WS-Management) from the probe host, Linux or Windows. This guide sets up a Windows host and an account for it, and explains the error messages the client gives. A Windows probe can use native WMI instead.

What Probeward does over WinRM:

  • It only enumerates WMI classes with WQL SELECT queries in root/cimv2. It never opens a shell, runs a command or calls a WMI method, so the monitoring account cannot change anything through Probeward.
  • Over HTTP (port 5985) every message after the login is encrypted with the session key of the login, as Windows requires by default. Probeward never sends a query in clear text and never asks you to set AllowUnencrypted.
  • Over HTTPS (port 5986) the certificate is verified against the probe host's trust store, unless you switch on "accept a self-signed certificate" for the credential or the sensor.
  • Every request ends within the sensor's poll timeout, and a response larger than 4 MiB is refused.

The sensors are CPU, memory, disk, disk activity, network adapter, automatic services, one service, event log, uptime and installed update age, processes and file or folder, IIS, SQL Server and Active Directory replication.

1. A read-only account ​

Create a dedicated account that is not an administrator. In a domain, make it a domain user (for example svc-probeward) and put it in a domain group (for example Probeward Monitoring) so the rights below can be given to the group once by Group Policy. On a stand-alone machine, a local user does the same job.

The account needs these rights on each monitored machine, and no others:

RightWhyHow
Member of Remote Management UsersLets the account log in to WinRM.Local group; by GPO with Restricted Groups or Group Policy Preferences, or Add-LocalGroupMember -Group "Remote Management Users" -Member <account>
Enable Account and Remote Enable on the WMI namespace root\cimv2Lets the account read WMI remotely. Without it every query fails with "access denied".wmimgmt.msc, right-click WMI Control, Properties, Security, Root\CIMV2, Security, add the account or group, tick both, Advanced, "This namespace and subnamespaces"
Member of Performance Monitor UsersThe CPU, disk activity and network adapter sensors read performance counters.Local group, as above
Member of Event Log ReadersThe event log sensor reads the System and Application logs.Local group, as above

The Security log needs more than Event Log Readers: on most systems only administrators, or accounts with the "Manage auditing and security log" right, may read it. Leave it out unless you need it.

A local account that is an administrator is filtered by User Account Control when it logs in remotely and gets only a standard token. That is one more reason to use a non-administrator account with the rights above rather than an administrator.

2. Enable WinRM ​

By Group Policy ​

In a GPO linked to the machines:

  1. Computer Configuration, Policies, Administrative Templates, Windows Components, Windows Remote Management (WinRM), WinRM Service: enable Allow remote server management through WinRM, with the IPv4 and IPv6 filters set to the probe hosts' addresses (or *).
  2. Leave Allow unencrypted traffic and Allow Basic authentication disabled. Probeward needs neither.
  3. Computer Configuration, Policies, Windows Settings, Security Settings, System Services: set Windows Remote Management (WS-Management) to Automatic.
  4. Add the firewall rule from section 3.

By hand ​

In an elevated PowerShell on the machine:

Enable-PSRemoting -SkipNetworkProfileCheck -Force

or, for WinRM alone without the PowerShell endpoints:

winrm quickconfig -quiet

Both create an HTTP listener on 5985, start the service and set it to start automatically. Check the listener with winrm enumerate winrm/config/listener and the service settings with winrm get winrm/config/service: AllowUnencrypted should be false.

3. Firewall ​

Allow inbound TCP 5985 (HTTP) and, if you use it, 5986 (HTTPS) from the probe hosts only. The built-in rule "Windows Remote Management (HTTP-In)" covers 5985; restrict its remote addresses:

Set-NetFirewallRule -Name WINRM-HTTP-In-TCP -RemoteAddress 192.0.2.10
New-NetFirewallRule -Name Probeward-WinRM-HTTPS -DisplayName "WinRM HTTPS from Probeward" `
  -Direction Inbound -Protocol TCP -LocalPort 5986 -RemoteAddress 192.0.2.10 -Action Allow

On client editions of Windows the built-in rule only admits the local subnet on Public networks. A firewall that drops the port shows in Probeward as a timeout, one that rejects it as unreachable.

4. HTTPS listener (optional) ​

HTTP with message encryption is secure enough for most networks and needs no certificate. Use HTTPS when your policy requires TLS, or when you want Basic authentication. The machine needs a certificate for its DNS name with the Server Authentication purpose, issued by a CA the probe host trusts (in a domain, an auto-enrolled computer certificate). Then:

New-Item -Path WSMan:\localhost\Listener -Transport HTTPS -Address * `
  -CertificateThumbPrint <thumbprint> -Force

In Probeward, switch on https on the sensors (the port becomes 5986). If the certificate is self-signed or issued by a CA the probe host does not trust, either install the CA certificate on the probe host or switch on "accept a self-signed certificate" on the credential. That switch turns off verification for that credential, so anyone who can intercept the connection can read the password; prefer installing the CA.

5. The credential in Probeward ​

Create a credential of kind Windows (WinRM) under Settings, Credentials, and set it as the Windows credential on the probe, group or device. Sensors and discovery below inherit it.

FieldMeaning
User namesvc-probeward, CORP\svc-probeward or svc-probeward@CORP.EXAMPLE.COM.
PasswordThe account's password. Stored encrypted, never shown again.
AuthenticationNegotiate (the default): Kerberos when a realm is set, NTLM otherwise. Kerberos or NTLM to insist on one. Basic only over HTTPS.
DomainThe NTLM domain (NetBIOS name, for example CORP). Empty for a local account. Ignored when the user name contains DOMAIN\.
RealmThe Kerberos realm, which is the Active Directory DNS domain in capitals (CORP.EXAMPLE.COM). Setting it selects Kerberos.
KDCA domain controller, dc1.corp.example.com or dc1.corp.example.com:88. Empty means the realm's DNS name, which resolves to the domain controllers.
Accept a self-signed certificateSee section 4.

When Kerberos is chosen, a Kerberos failure is reported as one. Probeward never falls back to NTLM on its own, so a misconfigured realm cannot quietly weaken the login.

6. Kerberos ​

Kerberos is the better choice in a domain: the password goes only to the domain controller, the target proves its identity, and NTLM can be switched off in the domain. It needs three things to be right.

  • DNS names. The ticket is for the service principal HTTP/<name>, where <name> is the device's host name in Probeward. An IP address has no service principal, so a device without a host name cannot use Kerberos. Use the name the machine is registered under in Active Directory, normally its fully qualified DNS name (web01.corp.example.com).
  • The SPN. Joining a domain registers HOST/<name> for the computer account, and HTTP/<name> is covered by it. If HTTP/<name> is registered explicitly on another account (a web application pool, for example), tickets are encrypted for that account and the WinRM service cannot read them. Check with setspn -Q HTTP/web01.corp.example.com and remove the stray registration, or monitor the machine under another of its names.
  • Clocks. Kerberos refuses a request when the clocks of the probe host and the domain controller differ by more than five minutes. Run NTP on the probe host against the domain's time source.

The account must have AES keys: Probeward uses AES-256 and AES-128 only, never RC4 or DES. An account created on a current domain has them. For an old account, tick "This account supports Kerberos AES 256 bit encryption" and change its password once.

Probeward reaches the KDC on TCP port 88. Allow that from the probe host to the domain controllers.

What a poll costs ​

A login on a new connection takes a TCP connect and two HTTP round trips for NTLM (negotiate, then authenticate). For Kerberos it takes three KDC exchanges (each on its own TCP connection to port 88) and one HTTP round trip. Each query then takes one HTTP request, plus one more for each further page of 200 objects. Every login also writes a logon event to the target's Security log.

So that a host with several Windows sensors is not logged into for every poll, Probeward keeps the authenticated connection for the next poll of the same target with the same credential:

  • for at most 90 seconds after its last use (Windows closes an idle connection after two minutes) and 15 minutes after the login, so the target checks the account at least that often;
  • at most two idle connections per target and credential, and 256 in all;
  • never for a different credential: the connection is found by the target and every field of the credential, so a changed password or user takes effect at the next poll, and the old connection is dropped as soon as the new one has logged in;
  • dropped at once on any authentication failure. A kept connection that the target has closed is replaced by a new login, and the poll's read-only queries are sent again.

A Kerberos service ticket is kept the same way, until five minutes before the end time the KDC gave it, so a new connection to a machine needs no KDC exchange either.

Measured against a Windows 11 machine on the local network, one round of the eight sensors discovery proposes (seven over WinRM):

TCP connects per pollHTTP requests per pollTime per poll
a login for every poll13.7248 ms
connection kept01.7241 ms

On a local network the login costs only milliseconds. The time goes into WMI on the target: the installed updates query (Win32_QuickFixEngineering) takes about 1.4 seconds and the services query about 180 ms, and the other sensors answer within 10 ms. Over a slow link, or with Kerberos, the saved round trips count for more.

Troubleshooting ​

The messages below are those the WinRM client gives, with the failure kind in brackets. <addr> is the target's address and port.

Reaching the target ​

MessageCause and fix
no answer from <addr> within N ms: the port is filtered by a firewall, or the host is down (timeout)A firewall drops the packets, or the machine is off. Check section 3.
connect to <addr>: connection refused (unreachable)Nothing listens on the port: WinRM is not enabled, or HTTPS is selected without an HTTPS listener.
<addr> answered HTTP N to /wsman without asking for WinRM authentication: not a WinRM listener (protocol)Another web server owns the port.
the server on the WinRM port does not speak HTTP (protocol)The port is used by something that is not HTTP, or HTTPS is needed and not selected.
the WinRM HTTPS certificate of <addr> is not trusted: ... (protocol)See section 4.
TLS handshake with <addr> failed: ... (protocol)The listener's certificate or TLS settings do not match; often HTTP selected on the HTTPS port or the reverse.

Logging in ​

MessageCause and fix
<addr> rejected the Windows credential for <user> (NTLM): wrong user name or password, a locked or disabled account, or an account that may not use WinRM (auth_failed)Check the password, the domain, and that the account is in Remote Management Users.
<addr> does not offer Negotiate authentication on WinRM (it offers: ...) (auth_failed)Negotiate is switched off in the WinRM service settings.
<addr> refused to start NTLM authentication; NTLM may be disabled on the target or in the domain (use Kerberos) (auth_failed)The domain restricts NTLM. Set the realm on the credential.
Basic authentication sends the password in clear text and is only used over HTTPS; ... (config)Basic was chosen on a sensor that uses HTTP.
Kerberos needs a realm: set it on the credential ... (config)Kerberos was chosen without a realm.
Kerberos needs the target's DNS name for its service principal (HTTP/<name>); ... (config)The device has only an IP address. Set its host name.

Kerberos ​

MessageCause and fix
cannot find the KDC <kdc> (...); set the KDC on the credential or make the realm's name resolve to a domain controller (config)The realm's DNS name does not resolve from the probe host.
cannot reach the KDC at <kdc>: ... (unreachable)TCP 88 to the domain controller is blocked or closed.
no answer from the KDC at <kdc> in time (timeout)The domain controller does not answer on TCP 88.
the KDC does not know the user <user>@<REALM> (auth_failed)The user name or the realm is wrong.
the KDC rejected the password for <user>@<REALM> (auth_failed)Wrong password.
the KDC's answer does not decrypt with the password of <user>@<REALM>: the password is wrong (auth_failed)Wrong password, for an account that does not require pre-authentication.
the KDC refused <user>@<REALM>: the account is disabled, locked out or expired (auth_failed)As it says.
the password of <user>@<REALM> has expired (auth_failed)Set a new password, and consider "password never expires" for the service account under your policy.
the KDC has no service principal HTTP/<name> in <REALM>: register it (setspn -S) or set the device's host name to the name it is registered under (config)The host name in Probeward is not the name the machine is known by in the domain, or the DNS suffix is missing.
the clocks of Probeward and the KDC differ too much (Kerberos allows five minutes); synchronise both with NTP (config)Clock skew; see section 6.
the KDC has no AES key for <user>@<REALM>; ... or the KDC chose RC4 for this ticket; ... (config)The account has only RC4 keys. See section 6.
the KDC is not responsible for the realm <REALM>; ... (config)The KDC on the credential belongs to another domain.
<addr> refused the Kerberos ticket for <user>@<REALM>: the target could not decrypt the Kerberos ticket: the SPN HTTP/<name> is ... (auth_failed)HTTP/<name> is registered on another account; see the SPN point in section 6.
<addr> refused the Kerberos ticket for <user>@<REALM> to HTTP/<name>: ... (auth_failed)The ticket was valid, but the target did not admit the account: usually a missing Remote Management Users membership.
the server's Kerberos answer does not decrypt with the ticket's session key: it is not the service the ticket was issued for (protocol)Something other than the intended machine answered. Check DNS for the host name.

Querying ​

MessageCause and fix
access denied: ... The account needs Remote Enable on the WMI namespace and membership of Remote Management Users (auth_failed)The WMI namespace rights from section 1 are missing.
the WMI class does not exist: ... (config)The class is not on this Windows version.
the WMI namespace does not exist: ... (config)Only root/cimv2 is used; this points to a damaged WMI repository.
the WQL query was rejected: ... (config)A parameter produced a query WMI does not accept.
the server refused an unencrypted message: ... (protocol)Should not happen, since Probeward always encrypts over HTTP; report it.
WinRM quota exceeded on the target: ... (protocol)Too many concurrent WinRM sessions for the account; lower the number of sensors polling at once or raise MaxConcurrentOperationsPerUser.
the WMI query timed out on the target: ... (timeout)WMI on the target is slow or stuck. Restarting the Winmgmt service usually clears it.
WinRM exchange with <addr> did not finish within N ms (timeout)The whole exchange took longer than the poll timeout. Raise the timeout, or check the target's load.
the WinRM response is larger than the limit of 4096 KiB; narrow the query (protocol)A single answer was too large. For the event log, filter by source or event id.

What has been tested ​

  • NTLM over HTTP with message encryption: tested against Windows 11.
  • HTTPS certificate verification, the self-signed switch and Basic: tested against a local TLS listener, not yet against a Windows HTTPS listener. NTLM over HTTPS with channel binding is not yet tested against Windows.
  • Kerberos: tested against an MIT Kerberos KDC and a WS-Management endpoint built on MIT's GSSAPI, and against the KDC and the WinRM service of a Windows Server 2022 domain controller: login with a password, sealed requests and responses, the kept session and service ticket, and the wrong-password and unregistered-service-principal failures. Not yet tested against Windows: an account that needs pre-authentication to be switched off, RC4-only accounts, a KDC in another site than the target, and cross-realm trust.
  • Keeping connections between polls: tested live with NTLM against Windows 11, against the local TLS listener (a different password never gets the kept connection), and with Kerberos in the lab (the kept ticket opens a new connection without asking the KDC).

AGPL-3.0-only