Backup or Copy Windows Server 2008 Configuration

No Comments

In Windows Server 2008 there is a backup tool called Windows Server Backup which however creates huge backup files. I prefer to use a simple command/batch file that copies everything I want to backup, zips it and then uploads it to Amazon S3 (aka “the cloud”)

I have not been able to find a simple way to copy all of my Windows Server 2008 settings. Theses are the bits and pieces I have found:

Copy IIS7 Configuration

To save IIS 7 (Internet Information Services) configuration, copy the config directory %SYSTEMROOT%\System32\inetsrv\config, example:

xcopy %SYSTEMROOT%\System32\inetsrv\config c:\backup\iisconfig\ /S/E

Windows Advanced Firewall Export Configuration

To export all the current configurations of your firewall to a file:

netsh advfirewall export c:\backup\advfirewall.wfw

Source: David Davis

Export Windows Registry

To export the Registry, use regedit.exe command line options. Note that export is done in background so you need to allow some time before you are able to access the exported file.

regedit /e c:\backup\regbackup.reg

Source: Speedguide

Network Settings

netsh dump > c:\backup\network-settings-netsh-dump.txt

Source: Chris Sanders

 

Please note that this method cannot and should not to be compared to a full backup method such as Windows Server Backup.

This method will not allow you to do a full recovery. It will mean installing Windows Server and all software from scratch and then recover the data you have backed up. Meaning an unrecoverable hard drive crash would most likely mean more downtime/recovery time.

The reason I like this method is because it takes less space which allows me to use S3 to save my backups. That means I can fully automate it (scheduled batch script and no need to change any media) and it is off-site (meaning if there is a fire where my server is, my backup is still safe). And I prefer the ease of just getting my files from a zip file if I need to check or recover anything. Besides, it’s dirt cheap, I pay Amazon S3 a few dollars for a month worth of daily 1GB backups.

Amazon S3 Command Line Copy for Windows

31 Comments

A couple of months ago I started to use Amazon S3 (Amazon Simple Storage Service) as off site backup for one of my servers. It’s dirt cheap and so far it works very well (I’m paying less than $1 per month for my daily uploads and storage!)

The server is running Windows Server 2008 and my backup routine is simply a scheduled bat/cmd file to copy everything to a temp folder, then zipping it to a single file that I move off site (I used to ftp it to another host but you cannot use ftp with S3)

So, I needed to be able to upload my zip file to Amazon S3 using the command line. But unfortunately the only S3 copy or backup tools I found for Windows was either graphical and user driven or required Java, Perl or such and I didn’t really feel like installing any of that stuff on my server just for this simple task.

The solution was to write my own copy routine in C# (.NET Framework 2.0) which I did using one of the many S3 libraries available, in my case I selected the Affirma Threesharp C# Library. The result is a very simple copy routine, you can only copy one file at a time, no wild cards etc. I will probably extend it in the future, for example a delete routine so I can also automate deleting old backups (I’m currently using the s3fox plugin for Firefox to check on my backups and do deletes about once a month)

Syntax: s3copy Localpath Bucket Filename AccessKeyId SecretAccessKey

Example: s3copy.exe c:\backup\ mybackupbucket backup.rar MyAccessKeyId MySecretAccessKey

It’s a single exe file. No need to install anything, the dll is contained in the exe. Feel free to use it if you like!

Click button below download S3Copy.exe from Download.com
Get it from CNET Download.com!

[ Edit/10 May 2009: Thanks to Brad! Corrected post + exe so that Access Key Id and Secret Access Key can be entered (you find your keys at Amazon’s AWS: Your Account + Access Identifiers) ]
[Edit/15 June 2009: Moved file download to download.com]