Solved

Need script to copy & replace a backup file on Windows PC to Windows server.

Posted on 2011-03-11
7
400 Views
Last Modified: 2012-05-11
I need a script to copy a backup file from a Windows XP computer to a Windows server 2008 by using the task manager on the XP computer....rough mapping would be...

\\UserPC\deptfile\backup\backup.bak

to

\\server\data\dept\backup\

The XP computer is on a domain with access to the server.

Also need the script to overwrite the previously backed up file on the server. Thx.
0
Comment
Question by:Wilmette
7 Comments
 
LVL 8

Expert Comment

by:jawa29
ID: 35108278
Hi Wilmette

How's this?

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\UserPC\deptfile\backup\backup.bak" , "\\server\data\dept\backup\", OverwriteExisting

Jawa29

0
 
LVL 3

Accepted Solution

by:
brd24gor earned 500 total points
ID: 35110755
Alternatively, you could have your task run this line of code without needing a script:
echo F | xcopy /y /f /i \\UserPC\deptfile\backup\backup.bak \\server\data\dept\backup\backup.bak

Open in new window

0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 35113788
Save this as a BAT file, and then create a scheduled task in Windows task scheduler to run it at the desired time and frequency.

@echo off
set CopyFile=\\UserPC\deptfile\backup\backup.bak
set DestDir=\\server\data\dept\backup
if not exist "%DestDir%\" md "%DestDir%\"
xcopy /y "%CopyFile%" "%ToDir%\"

Open in new window

~bp
0
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 
LVL 6

Expert Comment

by:Flipp
ID: 35115942
If you need a good solid tool for this type of oPeration, then you can try Robocopy from the 2003 Resource Kit.
0
 

Author Comment

by:Wilmette
ID: 35137479
Thanks for the replies. I forgot to explain that the script will be run daily in MS Task Manager.
0
 

Author Comment

by:Wilmette
ID: 35137776
I should say...Task Scheduler not Task Manager...ooops
0
 
LVL 6

Expert Comment

by:Flipp
ID: 35142396
You can use either solution by creating an executable scripted file and then calling that file from the MS Scheduled Task.

Do you need the code for the function you requested above?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article may be useful for troubleshooting your PC. Power Supply - no lights or fans running If you have no lights or fans running then either you power is bad, turned off (check switch) or the power supply needs to be replaced. That's a r…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question