dnf
dnf

Reputation: 1789

Problem with New-PSSession - content type is absent or invalid

I have weird problem with New-PSSession command. When I try to connect to server with

New-PSSession -ComputerName "xxx"

I have response

The WinRM client cannot process the request. It cannot determine the content type of the HTTP response from the destination computer. The content type is absent or invalid. For more information, see the about_Remote_Troubleshooting Help topic.

But other users can connect to machine. The funny thing is that the same error occurs when logged on this server (I have an error but other person can execute) so it looks like some permission issue. I tried

Set-PSSessionConfiguration -Name "PowerShell.7" -ShowSecurityDescriptorUI

and I can see Administrators can do everything and I'm and administrator on that machine. I also tried tips from this site https://support.entuity.com/hc/en-us/articles/360019058197-How-do-I-configure-and-troubleshoot-WinRM but I still have same error. Any ideas?

Upvotes: 0

Views: 493

Answers (2)

dnf
dnf

Reputation: 1789

I finally found a problem - it was connected with the size of Kerberos token https://learn.microsoft.com/en-us/archive/msdn-technet-forums/4ecb3b43-039a-4c34-9be5-5825bbf82817. When somebody has too many permissions token is to large and configuration mentions in article above should be set.

Upvotes: 0

FlyingSubieSTi
FlyingSubieSTi

Reputation: 11

This is something we ran into on our remote servers a few years back.

What you need to do on each servers/computer requiring remote PowerShell access is to run the Enable-PSRemoting -Force command from an administrator PowerShell prompt.

Afterwards, you should be able to use the New-PSSession -ComputerName <compName>. Be sure you are using an administrator console, or else use the -credential flag with the proper credentials to access the subject computer.

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-5.1

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-pssession?view=powershell-5.1

Upvotes: 0

Related Questions