Solved

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

Posted on 2012-04-03
4
407 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 52

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
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 teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

863 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

22 Experts available now in Live!

Get 1:1 Help Now