github.com/dacamp/packer@v0.10.2/provisioner/powershell/powershell.go (about)

     1  package powershell
     2  
     3  import (
     4  	"encoding/base64"
     5  )
     6  
     7  func powershellEncode(buffer []byte) string {
     8  	// 2 byte chars to make PowerShell happy
     9  	wideCmd := ""
    10  	for _, b := range buffer {
    11  		wideCmd += string(b) + "\x00"
    12  	}
    13  
    14  	// Base64 encode the command
    15  	input := []uint8(wideCmd)
    16  	return base64.StdEncoding.EncodeToString(input)
    17  }