Class WinRmCli

java.lang.Object
org.metricshub.winrm.cli.WinRmCli

public final class WinRmCli extends Object
Command-line interface for WQL queries and remote command execution through WinRM, built on the streaming terminals of the fluent WinRMClient API.

WQL results are emitted as UTF-8 JSON Lines on standard output, row by row as the WS-Enumeration pages arrive — a large query starts producing output immediately and memory stays bounded, but a mid-stream failure can leave partial output on standard output (with a nonzero exit code). Remote command output is forwarded live to the matching local output stream while the command runs; when the local standard input is not an interactive console (piped or redirected), it is forwarded as the remote command's standard input. The shell subcommand starts cmd.exe on the remote host and bridges it to the local terminal, line by line, until the remote shell exits. Diagnostics are written only to standard error.

NTLM is the default authentication scheme. Kerberos requires HTTPS. HTTPS validates certificates and hostnames unless the explicitly insecure --https-permissive option is used. Password-file input is UTF-8 and has exactly one final LF, CRLF, or CR removed. Direct password arguments can be visible to other local processes and should be avoided in automation. When neither password option is supplied, the password is read securely from the interactive console.

Usage errors exit with 64, connection/TLS errors with 69, WinRM protocol errors with 70, authentication errors with 77, and timeouts with 124. Representable remote command exit codes (0 through 255) are propagated directly.

  • Method Details

    • main

      public static void main(String[] arguments)
      Run the WinRM command-line client.
      Parameters:
      arguments - command-line arguments