Documentation
¶
Overview ¶
Package winrm provides functionality for establishing and managing WinRM (Windows Remote Management) connections. It facilitates executing commands on remote Windows machines securely over HTTP(S) using the WinRM protocol.
Key Features:
- Establishes WinRM connections based on provided configuration.
- Handles authentication and secure communication with remote Windows hosts.
- Supports execution of commands including cmd and powershell commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Username string
Password string
Host string
Port int
UseTLS bool
Insecure bool
Timeout time.Duration
}
Config represents the configuration details for establishing a WinRM connection.
type Connection ¶
Connection represents a WinRM connection.
func NewConnection ¶
func NewConnection(config *Config) (*Connection, error)
NewConnection creates a new WinRM client based on the provided WinRM configuration.
func (*Connection) Close ¶
func (c *Connection) Close() error
Close closes the WinRM connection. Satisfies the Connection interface.
func (*Connection) Run ¶
func (c *Connection) Run(ctx context.Context, cmd string) (connection.CmdResult, error)
Run runs a command using the configured WinRM connection and context. It returns a connection.CMDResult object, including stdout and stderr.
func (*Connection) RunWithPowershell ¶
func (c *Connection) RunWithPowershell(ctx context.Context, cmd string) (connection.CmdResult, error)
RunWithPowershell runs a command using the configured WinRM connection and context via Powershell. It returns the result of the command execution, including stdout and stderr.