winrm icon indicating copy to clipboard operation
winrm copied to clipboard

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

Open GLWJP opened this issue 5 months ago • 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!

GLWJP avatar Sep 04 '24 09:09 GLWJP