Remote access to a server

Hello,

 

In my company i have to write a script that can :

  1. “Connect to an other server” (\Serveur\x$\the\path) as a specific user (with password)

  2. “Get a html file”

  3. "Put it on the first server (x:\the\path\i\chose)

 

for some reasons i can ping the remote server, i can manually access to (\Serveur\x$\the\path) but i can’t do it with Powershell.

May i have some help ?

Best regards,

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

 

 

Hi,

Please make a below check on the both the servers in picture.

  1. Server should ping each other and try to access SMB share for both using
    \Server01\C$\

  2. Check firewall settings using the below command and match
    netsh advf show allp state

  3. Check WinRM service on both machines also check if Port 5985 is responding to Telnet

  4. Check Execution Policy by command Get-ExecutionPolicy.
    Kindly set the execution policy to Unrestricted or Bypass the execution policy in order to establish connection.

  5. 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.

Thanks
Vikramjit

First of all thanks for your answers.

I found some interesting things with “net use” and i tried this way :

net use L: $from_path /user:$username $pass

copy-item $from_path’\replication.html’ -Destination $to_path

net use L: /delete


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…