Skip to main content

Windows Remote CLI Documentation

The MetricsHub Windows Remote CLI allows you to execute Windows OS commands (CMD commands) on remote Windows systems via WMI or WinRM protocols. It enables administrators to run commands like ipconfig, systeminfo, tasklist, and other Windows command-line utilities on remote hosts.

With WinRM, use --read-file and --list-files to check what a File source can access from the MetricsHub host without logging on to the Windows host.

Syntax​

winremotecli HOSTNAME [--command COMMAND | --read-file PATH | --list-files PATTERN] [--wmi | --winrm] [WMI_OPTIONS | WINRM_OPTIONS]

Options​

OptionDescriptionDefault Value
HOSTNAMEHostname or IP address of the Windows remote-enabled device. This option is required.None
--commandWindows OS command (CMD command) to execute.None
--read-fileReads a remote file. Requires --winrm.None
--list-filesLists remote files matching a file-source path pattern, such as C:\logs\*.log. Requires --winrm.None
--wmiEnable WMI protocol for command execution. Either --wmi or --winrm must be specified.None
--winrmEnable WinRM protocol for command execution. Either --wmi or --winrm must be specified.None
-vEnables verbose mode. Use -v for basic logs, -vv for detailed logs.None
-h, --helpDisplays detailed help information about available options.None

Specify exactly one of --command, --read-file, or --list-files. The file options are available only with --winrm.

WMI Options​

When using --wmi, you can specify additional WMI-specific options:

OptionDescriptionDefault Value
--wmi-usernameUsername for WMI authentication.None
--wmi-passwordPassword for WMI authentication. If not provided, you will be prompted interactively.None
--wmi-timeoutTimeout in seconds for WMI operations.30
--wmi-force-namespaceForce a specific namespace for connectors that perform namespace auto-detection (advanced).None

WinRM Options​

When using --winrm, you can specify additional WinRM-specific options:

OptionDescriptionDefault Value
--winrm-transportTransport protocol for WinRM. Possible values: HTTP or HTTPS.HTTP
--winrm-usernameUsername for WinRM authentication.None
--winrm-passwordPassword for WinRM authentication. If not provided, you will be prompted interactively.None
--winrm-portPort for WinRM service (default: 5985 for HTTP, 5986 for HTTPS).Auto-detect
--winrm-timeoutTimeout in seconds for WinRM operations.30
--winrm-authComma-separated ordered list of authentication schemes. Possible values: NTLM, KERBEROS.NTLM
--winrm-force-namespaceForce a specific namespace for connectors that perform namespace auto-detection (advanced).None
--winrm-trust-all-certificatesTrusts all server certificates and skips hostname verification over HTTPS. Only applies when --winrm-transport HTTPS is used.true

Examples​

Example 1: Execute Command via WMI Protocol​

winremotecli dev-01 --wmi --wmi-username admin --wmi-password secret --command "ipconfig /all"

Example 2: Execute Command via WinRM Protocol​

winremotecli dev-01 --winrm --winrm-username admin --winrm-password secret --command "systeminfo"

Example 3: Interactive Password Input​

winremotecli dev-01 --wmi --wmi-username admin --command "tasklist"

The CLI prompts for the password if --wmi-password or --winrm-password is not provided.

Example 4: WMI with Custom Timeout​

winremotecli dev-01 --wmi --wmi-username admin --wmi-password secret --command "dir C:\\Windows" --wmi-timeout 60

Example 5: WinRM with HTTPS Transport​

winremotecli dev-01 --winrm --winrm-username admin --winrm-password secret --command "systeminfo" --winrm-transport HTTPS --winrm-port 5986

Example 6: WinRM with Custom Authentication​

winremotecli dev-01 --winrm --winrm-username admin --winrm-password secret --command "tasklist" --winrm-auth NTLM,KERBEROS

Example 7: List Remote Files with WinRM​

winremotecli dev-01 --winrm --winrm-username admin --winrm-password secret --list-files "C:\logs\*.log"

Example 8: Read a Remote File with WinRM​

winremotecli dev-01 --winrm --winrm-username admin --winrm-password secret --read-file "C:\logs\app.log"