Skip to content

WinRM

Execute PowerShell on Windows hosts.

See WinRM driver examples on GitHub.


Sends a command to the device via WinRM. Supports Basic and NTLM authentication. WinRM setup instructions

Signature

D.device.sendWinRMCommand(options, callback)

Parameters

options · `Object`
The WinRM Command execution options
options.command · `string`
The winrm command to execute against the device
options.username · `string` · optional
The device username. If not set the custom driver management purpose one is used. Use the form `DOMAIN\user` to authenticate against an Active Directory domain.
options.password · `string` · optional
The device password. If not set the custom driver management purpose one is used
options.port · `number` · optional, default `5985`
The WinRM port (default 5985 for HTTP, 5986 for HTTPS)
options.auth · `'basic'` | `'ntlm'` | `'auto'` · optional, default `'auto'`
Authentication scheme. When omitted or 'auto', it is inferred from the username (backslash => 'ntlm', otherwise 'basic').
options.scheme · `'http'` | `'https'` · optional
Transport scheme. Defaults to 'https' when port is 5986, otherwise 'http'.
options.skipVerify · `boolean` · optional, default `true`
When using HTTPS, skip TLS certificate verification. Set to false to enforce verification.
options.timeoutSec · `number` · optional
Per-command timeout in seconds.
callback · `callback`
The WinRM Command execution callback. Invoked with a single result object of the shape {outcome, error}: exactly one of the two top-level keys is non-null.
callback.result · `Object` · optional
The result object passed to the callback
callback.result.outcome · `Object` · optional
Present (non-null) when the command completed without a protocol error
callback.result.outcome.commandId · `string`
Id of the WinRM command
callback.result.outcome.shellId · `string`
Id of the remote shell that executed the command
callback.result.outcome.stdout · `string`
Standard output produced by the command
callback.result.outcome.stderr · `string` · optional
Standard error produced by the command
callback.result.outcome.exitCode · `int`
Exit code of the command (0 = success)
callback.result.error · `string` · optional
Present (non-null) when the command failed with a protocol/transport error; the underlying error object is JSON-encoded into a string

Returns

  • void

Example

D.device.sendWinRMCommand(options, callback)