Quantcast
Channel: Microsoft Community - Super Fresh
Viewing all articles
Browse latest Browse all 1237235

Execute Powershell command on remote computer

$
0
0

Hello, I would like to execute a PowerShell command on a remote computer. The command is the following:

Invoke-Command -ComputerName 10.40.27.174 -ScriptBlock { Get-ChildItem C:\ } -credential User

I get the following error:

[10.40.27.174] La connexion au serveur distant 10.40.27.174 a échoué avec le message d’erreur suivant: Accès refusé.
Pour plus d'informations, voir la rubrique d'aide about_Remote_Troubleshooting.
    + CategoryInfo          : OpenError: (10.40.27.174:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionStateBroken

So in English: "The connexion to the remote server 10.40.27.174 failed with the error message: Access denied."

Here is what I did: I have two computer with Windows 10 Home Edition. I start PowerShell admin on both computer. 

On both Computer I have executed:

Set-Item wsman:\localhost\client\trustedhosts *

and then

Restart-Service WinRM

I have seen that there are groups. So I also did:

net localgroup "Remote Desktop Users" "Elève" /add

I logged off and on and after

PS C:\windows\system32> Get-LocalGroupMember

applet de commande Get-LocalGroupMember à la position 1 du pipeline de la commande
Fournissez des valeurs pour les paramètres suivants :
Name: Remote Desktop Users

ObjectClass Name                  PrincipalSource
----------- ----                  ---------------
Utilisateur LAPTOP-U0369JC1\Elève Local

On the remote Computer the account is: Elève and there is no password. So When I

have to entered the password I simply press "Enter". I know it's bad for the security, but

it's for a small school.

Do you have an idea what's wrong ? Thank you!


Viewing all articles
Browse latest Browse all 1237235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>