masterzen/winrm

Title: High CPU and Bandwidth Usage When Running Commands Without Context

Opened this issue · 0 comments

Hi,

I am currently using an older version of the software and executing commands using the following method:

params := winrm.DefaultParameters
params.TransportDecorator = func() winrm.Transporter { return &winrm.ClientNTLM{} }
client, err := winrm.NewClientWithParameters(endpoint, "xxx", "xxx", params)
client.RunWithString(pshell, "")

I did not use the context like this:

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

I am experiencing high CPU and bandwidth usage with my current approach. Would switching to the RunWithContextWithString method help resolve this issue?

Thank you for your help!