Solved

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

Posted on 2012-04-03
4
408 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 53

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
most reliable laptop brand in 2016~ 8 96
Coding yesterday's date 3 24
Windows 7 Professional 6 54
msdos loop until a variable value changes 5 15
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
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.

786 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