I have been playing around with a few ideas on how to backup a server I have that is on the other side of town.
One of the problems I have is that the Internet provider blocks VPN traffic, and most other ways I know of getting a secure connection.
The one thing I can do is use remote desktop. After some experimentation, I have been able to schedule remote backups every night using robocopy, and a remote desktop connection.
(If you have not gotten robocopy yet, it is available for free in the Windows 2003 resource kit – Download Here)
Let me show you what I did to get this to work:
First, start out by properly configuring your remote desktop connection to automatically login, and share local files.
Open up remote desktop, and type in the username that you will use to login to the remote host. Check the option that allows you to save credentials

Next, we want to share the local drives, so we can copy our files over the RDP connection. Click on the “Local Resources” tab, and press the “more” button in the “Local Devices and Resources” section

Then check the “drives” option, or if you want to be more specific you can expand it and only select the drives you want to share

Now that you have all of that set, connect to the remote host once.
It will ask you if you really want to share those local resources – check the box that says don’t ask again

Type in your password, so it will remember it from this point forward:

Now – here is the good question. How do we get access to files? Well, when you are on the remote host, you can connect back to your own machine by using a virtual computer name: tsclient
If you want to access your local c drive from the remote host, you can go to start, then run, and type \\tsclient\c

Click OK, and you can see your local files

Now that we have that working, we create our backup script. This script will execute, and reside on the remote host. For my example, I am going to create a folder under c:\backup and a backup script named StuffBackup.bat

In my script above I am calling robocopy to copy the contents of c:\stuff, and copying only the files that have changed back on my local machine’s c:\stuff.
Now. We have our RDP connection setup properly, we have our backup script working. How do we get it to automatically run when connecting to this remote host?
Disconnect, and go back into the settings of the RDP client. Click on the “Programs” tab. Enter the path of the script you just created, and also make sure you fill out the “start in the following folder” entry – it won’t work without it.

Save your connection in a place where you can access it from the windows task scheduler. In my case I dropped it in c:\RemoteBackup

Double click on the saved connection to test it.

It should connect to the remote host, login, run your script, and then exit when it is finished.
Now. We have all the key settings in place. We have our RDP connection configured properly, got our backup script, and it should work when you double click on the icon.
How do we schedule it? Simple. Open task scheduler, and add a task. Set the RDP shortcut as your program to execute

Set your schedule and the backup will run automatically. Best of all the traffic is automatically encrypted by RDP.
Next week I will tell you how to get it to email you a log of the backup.

{ 1 trackback }
{ 0 comments… add one now }