Avatar of DevSupport
DevSupport
 asked on

powershell invoke-command error

Hi Experts,

I am using a invoke-command to authenticate using domain admin credentials which are stored using read-host command.

It works flawlessly on most servers but it does not work on a bunch of servers with same permission levels as the ones which work ok.

The error message:

[servername] Connecting to remote server servername failed with the following error
message : WinRM cannot process the request. The following error with errorcode
0x80090322 occurred while using Kerberos authentication: An unknown security
error occurred.
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are
specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does
not exist.
  -The client and remote computers are in different domains and there is no
trust between the two domains.
 After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM
TrustedHosts configuration setting or use HTTPS transport.
 Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command:
winrm help config. For more information, see the about_Remote_Troubleshooting
Help topic.
    + CategoryInfo          : OpenError: (vtimeqa:String) [], PSRemotingTransp
   ortException


There is largely no difference between the server which works and the one which doesn't work.

I think my issue is similar to what is written here:
https://community.spiceworks.com/topic/1066827-isolated-psremote-issue

I tried to connect with IP address but still doesnt work.

No firewalls in the server which I'm trying to connect.
Powershell* WinRM

Avatar of undefined
Last Comment
DevSupport

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jason Crawford

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Shaun Vermaak

Can you authenticate with something else, like a file share etc.?
DevSupport

ASKER
@Shaun

I can authenticate with everything else, open fileshare login to the remote server and do all admin tasks, except when I do Invoke-Command or

Enter-PSSession -Computer computername

I get this error:

towards the end it says:

At line:1 char:1
+ Enter-PSSession -Computer compname
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (compname:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
DevSupport

ASKER
@Jason,

setspn -D http/servername username

When I run the command  I get

Failed to remove SPN on account 'CN=user,OU=Users-SpecialPurposeAccounts,DC=
domain,DC=com', error 0x2098/8344 -> Insufficient access rights to perform the op
eration.

I think I dont have domain admin access. I will check with our admins and get back.

Thanks
DevSupport
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
DevSupport

ASKER
What I did:

setspn -D http/servername username

using domain admin credentials and it removed the existing spn.

After that I was able to connect.!

It did not work when I tried setspn -A and tried to add it back.