Force Powershell to use Kerberos instead of NTLM

I do have an application configured to support Kerberos authentication and doing HTTP calls to it from powershell like:

Invoke-WebRequest -V -Uri $url -Method "GET" -ErrorAction Stop -UseDefaultCredentials

If I do this call from another machine request is working fine, an Kerberos token is sent in the headers and authentication succeeds.

If I try the same request on the same machine where Web server is installed, Powershell sends automatically an NTLM token (in Authorization header) and because of that authentication fails.
I do not want to enable NTLM authentication on server.

Is there any possibility to:

  1. force Powershell to use always Kerberos protocol?
  2. or to disable NTLM protocol on a machine (not for entire domain)?

Hi Calin,

Welcome to the forums! In order to ensure that people can determine what is code and what is not, please go back and format your code using the </> button. This will make your code readable and easier to digest. Please also show any error messages you are getting along with putting all the code into the post so we can see what you are trying to do. I am including a link that will help you in getting your code formatted on the forums.

Guide for formatting code