We help IT Professionals succeed at work.

Script to cpy a file from source server to a share

Hi,

i need to copy a file from one server from c:\folder\file.csv  to a share \\server\folder.

the folder share is in another domain. the script need a login password to access in this share thanks.
Comment
Watch Question

CERTIFIED EXPERT

Commented:
hello.
microsofts robocopy has a mapping feature for username/password@domain for the source but not the destination.
http://www.microsoft.com/download/en/details.aspx?id=17657
you could run it from the destination .
CERTIFIED EXPERT

Commented:
and here is a gui for it
http://betterrobocopygui.codeplex.com/

Author

Commented:
Hi,

No i need a script to schedule it!

Author

Commented:
any help plz?
CERTIFIED EXPERT

Commented:
You can schedule it using Task scheduler on the source server
CERTIFIED EXPERT

Commented:
Go to Control panel, click on Scheduled Tasks and then select Add Scheduled Task
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016

Commented:
Or you can certainly create a small BAT file that invokes ROBOCOPY, and does any other setup or cleanup needed as part of the process, and then schedule the BAT file to run.

~bp

Commented:
You can also give the Microsoft Sync Toy a try.  It is able to be set on a schedule.
http://www.microsoft.com/download/en/details.aspx?id=15155
Commented:
Unless I am failing to see some nuance, the following, in Powershell, seems like it should work fine.  When you run this you are prompted to enter the password for the authentication.
Copy-Item -Path C:\folder\file.csv -Destination \\share\folder -Credential "altdomain\credential"

Open in new window

Furthermore, you can automate this as well by entering the password once and saving it to a file:

Powershell Tip - Storing and Using Password Credentials

Commented:
wls3, AWESOME tip on storing and using password credentials via PowerShell.

Author

Commented:
Thanks

Explore More ContentExplore courses, solutions, and other research materials related to this topic.