Open NikunjPatel31 opened 1 year ago
It's probably because the server requires NTLM authentication - I have a PR in to implement this in this repo but this seems to be not very active
you could use https://github.com/CalypsoSys/bobwinrm
see https://github.com/CalypsoSys/bobwinrmntlm for usage
Thank you @CalypsoSys for answer :-
Client NetworkDelayms = 5000 URLPrefix = wsman AllowUnencrypted = false Auth Basic = false Digest = true Kerberos = true Negotiate = true Certificate = true CredSSP = false DefaultPorts HTTP = 5985 HTTPS = 5986 TrustedHosts
AllowUnencrypted = false Auth Basic = false Kerberos = true Negotiate = true Certificate = false CredSSP = false CbtHardeningLevel = Relaxed DefaultPorts HTTP = 5985 HTTPS = 5986 IPv4Filter = IPv6Filter = EnableCompatibilityHttpListener = false EnableCompatibilityHttpsListener = false CertificateThumbprint
This is my winrm configuration.
endpoint := &winrm.Endpoint{Host: "Host", Port: 5985, HTTPS: false, Insecure: false, CACert: nil, Cert: nil, Key: nil, Timeout: 100}
params := winrm.Parameters{TransportDecorator: func() winrm.Transporter { return &winrm.ClientNTLM{} }}
client, err = winrm.NewClientWithParameters(endpoint, "username", "password", ¶ms)
shell, err = client.CreateShell()
Getting error while creating shell -"http response error: 401 - invalid content type"
The device I am trying to connect has NTLM enabled.
I tried to connect using python winrm library it got connected, but when I tried to connect it using go lang it is giving error. Python Library - pywinrm