Solved

Robocopy - Backup data from mutiple computers using list and batch file

Posted on 2012-04-03
4
406 Views
Last Modified: 2012-04-08
Hey guys,

I have been trying to develop a script to backup the Win XP "Documents and Settings" directory on computers in a pilot group we are getting ready to deploy Windows 7 to.

We have informed them to back up their own data and only doing this as a fail safe. I am not getting very far with this script and to be honest am at the end of a development phase that I can't think straight after. This is what I have so far. If someone could help me complete it I'd really appreciate it.

for /f  %%a in (PCList.txt) do (
md \\<serverpath>\%%a\
)
for /f  %%C in (PCList.txt) do (
   robocopy "\\%%C\C$\Documents and Settings\" ^
 \\<serverpath>\%%C\ /MIR /W:1 /R:1 ^
 /LOG+:"\\<serverpath>\%%C\%%C.log" ^
 /XD "\\%%C\C$\Documents and Settings\Administrator" ^
 "\\%%C\C$\Documents and Settings\Default User" ^
 "\\%%C\C$\Documents and Settings\All Users" ^
 "\\%%C\C$\Documents and Settings\%username%"
)

Open in new window


Cheers
G_M
0
Comment
Question by:G_M
  • 2
4 Comments
 
LVL 5

Assisted Solution

by:2Cs
2Cs earned 500 total points
ID: 37800410
This is the script I use to backup folders on demand:

echo on Replication Starting..........


:########################
:Clear all mapped drives#
:########################

net use * /d /y


:###################################
:Mapping of Replication directories#
:###################################

net use i: \\Server\Share
net use l: \\Server\Share
net use u: \\Server\Share
net use y: \\Server\Share
net use t: \\Server\Share
net use o: \\Server\Share$

:#########################
:Replication of - Web#
:#########################

robocopy i:\Webserver z:\Webserver /e /copy:DAT /R:2 /W:2


:#########################
:Replication of - DC02#
:#########################

robocopy \\Server\Documentation$ z:\Server\Documentation /e /copy:DAT /R:2 /W:2

robocopy \\Server\Users z:\Server\Users /e /copy:DAT /R:2 /W:2


:#############################
:Replication of - Server#
:#############################

robocopy y: z:\Server\Share /e /copy:DAT /R:2 /W:2


:########################
:Clear all mapped drives#
:########################

net use * /d /y

Open in new window


A list of switches and commands can be found here:

http://ss64.com/nt/robocopy.html
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 37800595
That doesn't look unreasonable, what problem(s) are you having?

~bp
0
 

Accepted Solution

by:
G_M earned 0 total points
ID: 37800622
The link that 2Cs sent pointed out an error in the source and destination paths

If either the source or desination are a "quoted long foldername" do not include a trailing backslash as this will be treated as an escape character, i.e. "C:\some path\" will fail but "C:\some path\\" or "C:\some path\." or "C:\some path" will work.

for /f  %%a in (PCList.txt) do (
md \\<serverpath>\%%a\
)
for /f  %%C in (PCList.txt) do (
   robocopy "\\%%C\C$\Documents and Settings" ^
 "\\<serverpath>\%%C" /MIR /W:1 /R:1 ^
 /LOG+:"\\<serverpath>\%%C\%%C.log" ^
 /XD "\\%%C\C$\Documents and Settings\Administrator" ^
 "\\%%C\C$\Documents and Settings\Default User" ^
 "\\%%C\C$\Documents and Settings\All Users" ^
 "\\%%C\C$\Documents and Settings\%username%"
)

Open in new window


Thanks for the link.

Cheers
G_M
0
 

Author Closing Comment

by:G_M
ID: 37820820
The link provided had comprehensive information about the tool I was using
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

759 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

17 Experts available now in Live!

Get 1:1 Help Now