robocopy file transfer to external server

This topic contains 1 reply, has 2 voices, and was last updated by  Mark Hammonds 1 year, 10 months ago.

  • Author
    Posts
  • #32618

    derek ebeling
    Participant

    I need to transfer files from one computer to a computer on another network using windows. The other computer requires user authentication. It currently works using rsync with Linux and a SSH key. However, I need to do this from a windows machine now. I am trying to do this with Net Use and Robocopy, but I keep getting a "System error 64 has occurred. The specified network name is no longer available." from the net use command.

    My current code:

    net use \\pcname.website.com\IPC$ /user:pcname\Username password
    robocopy "C:\directory" "\\pcname.website.com\folder\destination" /E
    net use \\pcname.website.com\IPC$ /Delete

    I have opened up ports 135-139 and 445 both UDP and TCP on the computer's firewall and the router. Is there something else I need to do to the remote machine or add to my code? I did not set up the remote computer profile, but I am the current sole maintainer of it and can edit is as necessary.

    Can someone please also clarify the following;
    1) I am assuming that using "\\pcname.website.com" in NET USE defaults to the user's home directory. Is this correct? Or does it default to the C: drive?
    2) What is the purpose of the "IPC$". I feel like I may be specifying this wrong.
    3) Can I use SSH with powershell and robocopy?

    I am using powershell 2.0. I am new to powershell and networking, but not new to programming.

    Thanks in advance.

  • #32622

    Mark Hammonds
    Participant

    Use the Fully Qualified Domain Name (FQDN)

    \\fqdn\c$\foldername\foldername

    Copy-item "c:\foldername\" -destnation "\\example.com\c$\foldername\" -credential (get-credential)

    https://technet.microsoft.com/en-us/library/hh849793.aspx

    here is the same example using robocopy

    RoboCopy "C:\homefolder" \\server.com\c$\destinationfolder /E /COPYALL /ZB /LOG+:C:\temp\RoboCopyLog.txt /TEE

You must be logged in to reply to this topic.