Solved

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

Posted on 2011-03-11
7
398 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 52

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now