Windows 10 Execute Powershell command on remote computer

  • Thread starter Thread starter CedricZT
  • Start date Start date
C

CedricZT

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!

Continue reading...
 

Similar threads

G
Replies
0
Views
2
Guy Trioreau
G
S
Replies
0
Views
40
ShahyadSharghi
S
S
Windows 7 WinRM
Replies
0
Views
135
Sk JafirAli
S
Back
Top