?
Solved

RoboCopy to Changing External Drives

Posted on 2016-10-26
2
Medium Priority
?
85 Views
Last Modified: 2016-10-26
Background:  I have archived a ton of data to an external hard drive (lets call this drive EXT-A) to free up space on the internal drives of a Windows Server 2012 R2 server.  EXT-A will remain permanently attached to the server.  This archived data will likely not be needed again, but I have to preserve it just in case (sort of like your old tax returns.)  Because losing this archive data is not an option, I have two additional external hard drives of the same size (we'll call these EXT-B and EXT-C, respectively), which will serve to backup the archive data.  I want to mirror the data from EXT-A to EXT-B or EXT-C (whichever one happens to be attached.)  EXT-B and EXT-C will never be attached concurrently...when one is attached, the other will be located offsite and vice versa...these two drives will be swapped weekly.  

In addition, the server to which these drives are attached is a Hyper-V host.  Since Hyper-V won't let me map EXT-A through to the file server, FS1 (which is a VM), I have created a file share on EXT-A so that data can be moved from FS1 to EXT-A via the file share.  We generate a lot of this 'archive'-class data and will move data from FS1 to EXT-A at least monthly if not weekly.  

Challenge:  I can create a RoboForm script that will mirror the data from EXT-A to EXT-B.  The problem lies in the fact that I need to swap between EXT-B and EXT-C, so that we always have a reasonably up to date copy of the archive data stored offsite.  There seem to be a couple of issues:  (1) The drive letters of EXT-B and EXT-C can't be relied upon to stay the same.  (2) If you setup a file share on EXT-B or EXT-C, the file share will disappear upon disconnecting EXT-B or EXT-C.  

It's not mandatory to use RoboCopy, but that is what I'm most familiar with.  

Any ideas of how to make this work well?
0
Comment
Question by:whc4
[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 Comments
 
LVL 25

Accepted Solution

by:
NVIT earned 2000 total points
ID: 41861044
Give each drive a unique Label, e.g. EXT-A, EXT-B, EXT-C.
Then, run a WMIC query for the Label that matches "EXT-".
The result shows the drive letter, which you can pass to robocopy.

Make a .bat file of this. Open a CMD window and run the .bat:
@echo off
for /f "tokens=1-4 delims=," %%a in ('WMIC PATH Win32_Volume WHERE "Label LIKE '%%EXT-%%'" GET DriveLetter^,DriveType^,Label /format:csv ^|find /i "EXT-"') do (
  echo robocopy /e "\\server\share\folder" "%%b\"
)

Open in new window

0
 

Author Closing Comment

by:whc4
ID: 41861265
Excellent!  Thank you!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

801 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