2012 and newer already have remoting enabled, you will need to enable it for anything older than 2012. If it’s 2012+ and not working take a look at the links below
Please make a below check on the both the servers in picture.
Server should ping each other and try to access SMB share for both using
\Server01\C$\
Check firewall settings using the below command and match
netsh advf show allp state
Check WinRM service on both machines also check if Port 5985 is responding to Telnet
Check Execution Policy by command Get-ExecutionPolicy.
Kindly set the execution policy to Unrestricted or Bypass the execution policy in order to establish connection.
Try enter-pssession Server01 or invoke-command to remotely access the server.
Incase you still face an issue do share the Error so that we can proceed further.
But the fact is that it works when i put command one by one in PowerShell but i am having a “system error 129 : Multiple connections to a server or resource shared by the same user, using more than one user name, are not allowed. Delete all previous connections to the server or shared resource and repeat.”
It is strange that it is working one way but not the other…