Link to home
Create AccountLog in
Avatar of fofanah78
fofanah78

asked on

File Transfer

I have 4 .img files that are 120mb each. i want to write a script for these files and schedule a task to have them transfer overnight to a remote locations.  How can i do this with windows 2008 tash scheduler??
Avatar of Gaurav Singh
Gaurav Singh
Flag of India image

That WebCommander stuff looks like overkill.  You didn't mention what language you wanted to script it in.  The script you ask for would be pretty easy to write in Powershell.  Do you have it installed?  If you're using Windows Server 2008 R2 then it's installed by default, but not non-R2.  You'd have to install it.

Also are the two locations on Windows servers joined to a domain?  This simplifies authentication in the script.
If you do have Powershell available on the server running the script then here's the code.  Put it in notepad and save it as a .PS1 file.  Just replace the source and destination with the locations you want on lines 2 and 3.  In Windows task scheduler create a task that calls the script like this:

-Action: Start a program
-Program/script: Powershell
-Add arguments: -file "c:\scripts\myscript.ps1"
#specify locations for source and destination
$source = "\\server1\c$\myfiles"
$destination = "\\server2\c$\myfiles"

#copy the files
Copy-Item -Path $source -Destination $destination

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Zouleous
Zouleous
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of fofanah78
fofanah78

ASKER

The powershell works!!!!

Thanks!!