Monthly Archives: March 2010

DPM: Scripting Additions to a Backup

image It’s beautiful when we are able to use features of DPM to backup an application as a whole (say, SharePoint or Hyper-V virtual machine), but what will happen when it is not enough to just copy files and system state (like in OCS in some cases, or Windows Server 2008 BMR Backup), or our MOSS 2007 farm configured in a way we can’t backup it at once (some SQL mirroring scenarios prevent us from doing so)?

Well… It is where scripting steps in.  DPM actually lets us to run any script before backup starts or after it finishes. Is it difficult? Not at all. Is it something I can recommend to create comprehensive backup packages, or run a bunch of pre-/post-backup tasks? Not really. Let us discuss why:

1) Difficulty. Actually you have just to publish your scripts to the local drive of a protected computer and change a configuration file. Script may be of any type: shell, VBS, PowerShell or even Perl. For example, script for BMR backup on Windows 2008 may look like

@echo off
setlocal enabledelayedexpansion
set BACKUP_TARGET=\BackupServerServerBackup
rd /s /q "%BACKUP_TARGET%WindowsImageBackup%computername%"
wbadmin start backup -backuptarget:"%BACKUP_TARGET%" -allcritical -quiet
if %ERRORLEVEL% == 0 (
rem    pushd "%BACKUP_TARGET%WindowsImageBackup%computername%"
rem    for /f "tokens=*" %%i in (‘dir /b /s *.vhd’) do move /Y "%%i"

)

(the code is almost from this document)

Anyway, the most important part of the task belongs to the file ScriptingConfig.xml which usually is situated in folder c:Program FilesMicrosoft Data Protection ManagerDPMScripting

The content of the file by default is:

<?xml version="1.0" encoding="utf-8" ?>
   </ScriptConfiguration>

What we need is to add some configuration before </ScriptConfiguration>. The final file looks like that:

<?xml version="1.0" encoding="utf-8" ?>

<ScriptConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/2003/dls/ScriptingConfig.xsd">

<DatasourceScriptConfig DataSourceName="c:">

  <PreBackupScript>"Path-To-Script or command line to run script"</PreBackupScript>

  <PostBackupScript />
  <TimeOut>90</TimeOut>
   </DatasourceScriptConfig>
  </ScriptConfiguration>

You see: everything looks clear in the code.

  • DataSourceName – the name of the data source before (or after) backing up which the script runs.
  • PreBackupScript – string which should run before backup
  • Postbackupscript – string which should run after backup
  • TimeOut – script timeout in minutes

Pretty simple, isn’t it?

2) Why not to do it unless you really have to? Well… It’ is hard to monitor whether the script worked fine or not. DPM console won’t tell you about it. For example, when we are speaking of Windows 2008 Bare Metal Recovery Backups we may backup any file on a file system preceding the backup with a script which makes BMR backup with WBAdmin.  If the file itself is backed up successfully then your DPM server will show you a green mark even if the BMR Backup script failed. The only ways to know if everything went good are:

  • Make a test recovery (good idea usually, but just imagine hundreds of servers backed up every week… Impossible to check them all every week)
  • Make the script complex enough to catch errors in a backup and report them. Again, not really bad idea, but it is totally unmanaged and may become very costly in large environments
  • Use 3rd party tools.

But for some tasks it is really good stuff and you may use it.

Pirates and Services…

It suddenly came to my mind, that the shift for SaaS, Clouds and all other fashionable technologies popped out, possibly, due to pirates’ activity. Yes, exactly those who are always complaining that a bunch of bytes cannot cost money. Look, those who create content need to earn from that, so they thought up, say, Cloud, to take money not for bytes, but for granting access to them. Just imagine the nearest future: user has a piece of hardware, given to him for free or for a minimal cost (those who want to tell me it’s a nonsense should recall iPhone which in many cases was sold for $1 and a huge contract). The device has some software inside (who wrote the code for it know but geeks like me: no one is interested was it MS, Apple or someone addicted to FSF), which in its turn just grants access to cloud apps. Moreover, the device doesn’t even have local storage, because it assumes the user to have communications sufficient to deliver any content quick and in high quality (not Sci-Fi today) and a contract with unlimited traffic. And the contract is the thing of interest in this idea:

1) The Basic one grants you right to call, surf and, say, to store 1Gig of data in the cloud.

2) More advanced contract in addition to the first one lets the user create and listen to a playlist of a hundred tracks at a time. Any tracks, but only a hundred. User wants to add new song – he or she has to remove an old one.

3) More expensive contract gives the user ability to create 3 playlists with three hudred songs in each.

4) An option to the contract gives the person right to download and play (oh no! We don’t have storage anymore… Then only play) any game on a game console… Only one game. Want to play another – pay more, or delete previous.

5) The Very Cool Plan will include ability to share the content above with some friends.

And so on, and so forth. That will be on a monthly payment, for example, what may appear to be cheaper or more expensive then buying the things. But it will be definitely more convenient and will create financial flow to the creators of the content. At the same time pirates will have not much to do and it will be quite complicated “to do”. For example, speaking of movies, what will be left to pirates are screen copies or getting the signal from inside a TV, where it (signal) goes to the screen. Moreover, pirate will be able to play the content only after hacking the device what will automatically lead to inability to use legal content (like in case of XBox).

To sum up: may be they are pirates, who rule us into clouds with an iron hand… =)

Ready for 2010 Scripting Games? Prepare!

image The Games’ organizers  have issued the list of skills necessary (Hey! No one told you the skills are sufficient 😉 ) for you to successfully pass through the Games’ tasks. Thus, what do you need to be ready:

1) Working with the registry

2) Event log

3) Text files and folders

4) Environment variables

5) WMI

6) Looping

7) Special folders

8) Arrays

9) Functions and subroutines

10) Errors handling

11) Graphical sccripting

On first sight it is such a list! But even a scripting newbie will learn a lot from the learning materials’ links which given by the organizers  with the other details.

Join and enjoy – it will be fun!