def powershell_wrap(cmd)
      shell = @shell_command || 'powershell'

      # Prevent progress stream from leaking into stderr
      script = "$ProgressPreference='SilentlyContinue';" + cmd

      # Encode script so PowerShell can use it
      script = script.encode('UTF-16LE', 'UTF-8')
      base64_script = Base64.strict_encode64(script)

      cmd = "#{shell} -NoProfile -EncodedCommand #{base64_script}"
      cmd
    end
def powershell_wrap(cmd)
      shell = @shell_command || 'powershell'

      # Prevent progress stream from leaking into stderr
      script = "$ProgressPreference='SilentlyContinue';" + cmd

      # Encode script so PowerShell can use it
      script = script.encode('UTF-16LE', 'UTF-8')
      base64_script = Base64.strict_encode64(script)

      cmd = "#{shell} -NoProfile -EncodedCommand #{base64_script}"
      cmd
    end
Wrap the cmd in an encoded command to allow pipes and quotes