1
votes

I've got a problem, i can't execute a powershell command in remote.

Invoke-Command -ComputerName MYCOMPUTER -Credential MYDOMAIN\MYUSER -ScriptBlock {Get-Culture}

and this is my error log:

Winrs error:WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found.

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.

I've got full rights on the server, i did "Enable-PSRemoting -Force" in admin, ,WinRm quickconfig" too, and i can ping the server and connect at it.

It's strange because i can do it on another server which has the same version of Windows (Windows Server 2008 R2) and the same version of powershell (2.0). Could you help me please ?

Thanks

1
Have you added in the Trusted hosts list ?Ranadip Dutta
I haven't did this on the first server, but i'm interested. How can i do that ?cpl1993
Ok, i've tried this: Set-item wsman:localhost\client\trustedhosts -value *, it's not working for mecpl1993
GO through this LINK first. It will be the first step for you. Then if you face any issue. let me know. Remember one PS has to trust the other system in order to run something remotelyRanadip Dutta
Thanks for your link @RanadipDutta, trusted Host was the right answer.cpl1993

1 Answers

1
votes

You can verify the availability of trusted hosts :

  1. Start Windows PowerShell as an administrator by right-clicking the Windows PowerShell shortcut and selecting Run As Administrator.

  2. At the PowerShell prompt, you can verify that the WinRM service is running using the following command:

    get-service winrm

The value of the Status property in the output should be “Running”.

  1. To configure Windows PowerShell for remoting, type the following command:

    Enable-PSRemoting –force

Use the below command to add the remote systems under trusted hosts:

winrm s winrm/config/client '@{TrustedHosts="RemoteComputer"}'

Then you can check the same using the below command:

winrm quickconfig

Reference Link : Enabling Remoting in Powershell