Friday, January 20, 2012

Backup Windows Server 2008 R2 to a Network Share and Retain Previous Backups

If you ever tried to configure the new Windows Server Backup (WSB) to make backups of your server on a network share, you'll be notified that only the last backup will be retained and the previous one will be deleted. Period. There is nothing you can do about this... or is it?

While everyone is shouting at Microsoft that they can't create a proper backup system, I have to disagree. The new WBS which replaced NTBackup is far more powerful than its predecessor. I admit, it has its own limitations and flaws, nothing is perfect though. There are indeed technical restrictions with the current design that prevent the new system to keep multiple backups. Maybe a future version will improve this.

Let's us go back to our problem... WSB is doing a nice backup job to a network share and it is able to restore it using the installation DVD in case of a major failure directly from the network share, if you backed up the system state of course. So here we have to be creative in order to keep multiple backups o a regular schedule... Let's unleash the power of the command line interface to WSB...

Create a batch file with the following content:

@echo off
set currentdate=%date:/=-%
set target=\\backupserver\backups\
set log=%target%backup log %computername% %currentdate%.txt
set errorlog=%target%backup error log %computername% %currentdate%.txt
set backuptarget=%target%WindowsImageBackup\%computername%
set desiredtarget=%target%%computername% - %currentdate%
 wbadmin start backup -allCritical -systemState -vssFull -backupTarget:%target% -user:myuser -password:mypassword -include:d: -quiet
 move "%backuptarget%" "%desiredtarget%"
) 1>>"%log%" 2>>"%errorlog%"

So what is this code do? First of all it sets up the variables needed then invokes the backup operation. After the backup is completed the backup folder is taken out of the original location and renamed to contain the backup date.

You will have to adjust the highlighted values to suit your own environment. Schedule this batch file as you wish using Windows Task Scheduler and you're done. Since you do the scheduling, you will also bypass the limitation of the WBS scheduling which is only once per day, every day. Note though that since I do not added the time to the folder name this batch file cannot be scheduled to run more than one time per day. However, you can schedule it to run only on weekends if you wish...

All you have to do now is to watch the backup server for disk space and delete old, unneeded backups.

To restore a given version, you will have to copy the day backup back into the WindowsImageBackup folder and remove the date. I did not renamed the WindowsImageBackup folder itself because to this location I backup multiple servers.

So here is the file/folder structure after a backup:

DC1 - Fri 01-20-2012\
DC2 - Fri 01-20-2012\

backup error log DC1 Fri 01-20-2012.txt
backup error log DC2 Fri 01-20-2012.txt
backup log DC1 Fri 01-20-2012.txt
backup log DC2 Fri 01-20-2012.txt

As you can see the following are created for each server (names are DC1 and DC2 here):

  • The backup folder for each server with the added date
  • An error log file (all errors will be dumped here)
  • A log file of the backup (all non-error messages will be dumped here)
(I've listed one day only for two servers, but the full picture will contain multiple days of course)

So if I want to restore for example DC1 from Fri 01-20-2012 for example, I need to do the following steps:
  1. Copy or move the folder "DC1 - Fri 01-20-2012" back to WindowsImageBackup
  2. Rename the copy to read "DC1" by removing the date component
  3. Perform the restore
Hope this helps you.

Thursday, June 10, 2010

The new Bing Webmaster Tools to debut soon

Microsoft is chasing Google with this one. It will offer a "Webmaster Tools" site which is similar with the Google's one.

The Bing Webmaster team held a session showed a preview of the next version of Bing Webmaster Tools, Microsoft’s no-cost toolset for webmasters and search engine optimizers (SEOs). Bing Webmaster Tools were rebuilt from the ground up to offer more data, including a new user interface and enhanced charting functionality.
The new Bing Webmaster Tools remain web-based, and basic functionality is available through most web browsers. They are very useful for search engine optimization or SEO.
To achieve the full potential of the new Bing Webmaster Tools user experience, you’ll want to install Microsoft Silverlight 4.0. Silverlight is a browser plug-in that helps organizations design, develop, and deliver rich applications and experiences on the Web. Silverlight works across multiple browsers, platforms, and devices, including the Mac OS, Windows and Linux operating system.
The Bing Webmaster team chose to focus on three key areas of interest to webmasters: Crawl, Index, and Traffic. Each area will offer detailed data going back as far as six months with dynamic charting capabilities, enabling webmasters to focus on the timeline trends that are most meaningful to them.
A key, new feature to Bing Webmaster Tools is Index Explorer, a tree-view that enables webmasters to see at a glance all of the crawling and index data for their website.
Bing Webmaster Tools has added a feature to Submit URLs that allows website owners & bloggers to send Bing a list of URLs that should be prioritized.
The Bing Webmaster Tools not only give webmasters control of what content to add to the Bing index, but the new Block URLs tool gives webmasters control over what content to block from the SERPs.

Wednesday, June 09, 2010

New widespread spam with PDF exploit

The antivirus labs are currently seeing a spam run pushing a PDF exploit. The emails look like this:

From: random addresses
To: random recipients
Subject: New Resume

Please review my CV, Thank You!

Attachment: resume.pdf

This PDF attachment it's attempting to use the PDF /launch feature. The PDF's MD5 is cff871a36828866de1f42574be016bb8. If allowed to run, the exploit will drop an alureon/dnschanger trojan.

Beware of attachments from spam mails, even the files with non-executable extensions could be dangerous.

Friday, May 28, 2010

New blog location

The main address of the blog is now The old one will continue to exist but will be redirected to the main one.

Tuesday, November 10, 2009

Nice Firefox bug


Take the following HTML:

[body onload="document.getElementById('a').innerHTML = '[input type=\'text\'/]';"]
[div id="a"][/div]
[input type="text"/]

(of course replace "[" with "<" and "]" with ">")

Open that in Firefox. Write something in the first input and press F5... see what happens... the value you just entered is now in the second input!
Add as many inputs and the shifting still occurs on all of them...