/go-winrm

Fast file copy over WinRM protocol for Go clients

Primary LanguageGoApache License 2.0Apache-2.0

Go Reference

Introduction

This package enables clients written in Go to quickly upload files to a Windows server, based on the Windows Remote Management (WinRM) protocol.

The approach to copying files is the same as Ansible's, and directories can be recursively copied in parallel. These two features make this package hundreds of times faster than github.com/packer-community/winrmcp.

To realize the above, this package exposes WinRM functionality useful for passing data to PowerShell pipelines via stdin, that is not available in github.com/masterzen/winrm:

  1. The command options WINRS_CONSOLEMODE_STDIN and WINRS_SKIP_CMD_SHELL are exposed. These options are defined here.
  2. The stdin stream of a command can be closed.

It should be noted that github.com/masterzen/winrm has better documentation than this package, and will probably be better maintained. But we have a simpler way of supporting different authentication methods, by allowing users to set a *http.Client rather than inventing another abstraction.

How do I use this package?

See test/main.go for example code.