Source File
powershell.go
Belonging Package
github.com/masterzen/winrm
package winrm
import (
)
// Powershell wraps a PowerShell script
// and prepares it for execution by the winrm client
func ( string) string {
// Disable unnecessary progress bars which considered as stderr.
= "$ProgressPreference = 'SilentlyContinue';" +
// Encode string to UTF16-LE
:= unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder()
, := .String()
if != nil {
return ""
}
// Finally make it base64 encoded which is required for powershell.
= base64.StdEncoding.EncodeToString([]byte())
// Specify powershell.exe to run encoded command
return "powershell.exe -EncodedCommand " +
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |