Remote PC: Windows 10 Client My PC: Windows 10 Client
On the remote PC:
New-PSSession -EnableNetworkAccess
When I try to connect from my PC to the remote PC, I always get the "New-PSSession : [localhost] Connecting to remote server localhost failed with the following error message : Access is denied." error.
New-PSSession -RemoteComputer <remoteComputerName>
New-PSSession -RemoteComputer <remoteComputerName> -EnableNetworkAccess
New-PSSession -RemoteComputer <remoteComputerIP>
New-PSSession -RemoteComputer <remoteComputerIP> -EnableNetworkAccess
$cred=Get-Credential
New-PSSession -RemoteComputer <remoteComputerIP> -EnableNetworkAccess -Credential $cred
winrs -r:<IP> -u:<userName> -p:<password> cmd.exe
https://learn.microsoft.com/en-us/powershell/scripting/learn/remoting/running-remote-commands?view=powershell-7.2 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_requirements?view=powershell-7.2 https://learn.microsoft.com/en-
But maybe I am missing something very basic here. Does the remote PC need to be a Windows Server perhaps?
This answer solved my issue.
On all systems to which I want to remote-in (remote and localhost) the following command needs to be executed:
Set-ItemProperty -Name LocalAccountTokenFilterPolicy -Value 1 -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System