Solved

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

Posted on 2012-04-03
4
412 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 56

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
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.
Suggested Courses

623 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