Hey All,
A question that is asked a lot, so I thought I write about it. Can VMWare virtual machines be protected by DPM 2010 (and also with DPM 2007 by the way )? The answer is YES. How cool is that?
Here is a how-to:
To achieve this, we need VDR backup. In the current version (1.0.2) the backup repository must be in an ‘inactive’ state when it is copied to tape. When is it in an active state? When the following conditions are met:
-
Performing a backup
-
Performing a restore
-
During housing keeping tasks such as integrity checks or pruning of old backup restore points
Because of that, we need to make sure that the VDR is in an inactive state before copying the data to tape, or with other words, shut down the VDR application.
This guide also assumes that you have already configured your VDR appliance and that the backups are scheduled and running.
Before I get to that, I’ll first explain what the prerequisites are on the DPM protected server! What does this mean? It has to be done on the server that holds the backup disk for the virtual machines.
- Powershell V1 or higher must be installed. Powershell is included in Windows Server 2008. For windows server 2003 download it here: http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx
- VMWare powershell commandlets should be installed. You can download them here: http://communities.vmware.com/community/vmtn/vsphere/automationtools/windows_toolkit
- Ensure powershell Remote execution is enabled. You can do this in powershell (elevated!) by using: Set-ExecutionPolicy RemoteSigned
So far the prerequisites. Now it is time to create all the scripts to do the job.
Number on:
Create a bat file called ShutdownVDR.bat (as example, the name is free to chose)
In this example, all scripts will be placed under c:\dpmscripts
Type the folliowing in the bat file (note! This must be on 1 line…)
%systemdirectory%\windowspowershell\v1.0\powershell.exe -PSConsoleFile “%programfiles%\VMware\Infrastructure\VSphere PowerCLI\vim.psc1” -Command <scriptname>
Or, in my example:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\VSphere PowerCLI\vim.psc1” -Command C:\DPMScripts\ShutdownVDR.ps1
The thorough reader has already seen that there is a .ps1 script that needs to be created… Here it is:
Connect-VIServer -Server <vCenterIPAddress> -Protocol https -User <adminUsername> -Password <password> shutdown-vmguest <VDRApplianceName> -Confirm:$False Disconnect-VIServer -Confirm:$False
or again according to my example
Connect-VIServer -Server 192.168.1.15 -Protocol https -User svc_user -Password VerYDiffICultPasswd shutdown-vmguest MP-VDR01 -Confirm:$False Disconnect-VIServer -Confirm:$False
Enough? No, we now have our shutdown of VDR in place, now it is time to create the startup.
StartupVDR.bat
%systemdirectory%\windowspowershell\v1.0\powershell.exe -PSConsoleFile “%programfiles%\VMware\Infrastructure\VSphere PowerCLI\vim.psc1” -Command <scriptname>
StartupVDR.ps1
Connect-VIServer -Server <vCenterIPAddress> -Protocol https -User <adminUsername> -Password <password> Start-VM <VDRApplianceName> Disconnect-VIServer -Confirm:$False
Configure the protected server
Now you need to configure the protected server so that it will execute pre and post scripts when it needs to perform a backup.
You do this by editing the Scriptingconfig.xml file on that protected server. This can be found under the agent installation directory (%programfiles%\Microsoft Data Protection Manager\DPM\Scripting\)
<?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="<DataSource>">
<PreBackupScript><path>\<Script></PreBackupScript>
<PostBackupScript><path>\<Script></PostBackupScript>
<TimeOut>15 </DatasourceScriptConfig>
</ScriptConfiguration>
Change the path\script to the correct values. In my case it is c:\dpmscripts\shutdownVDR.bat for prebackup and c:\dpmscripts\startupVDR.bat for postbackup
Now just create a protection group that protects the specific drive and off you go…
With a lot of thanks to my colleague Arne Peleman.
Enjoy
Cheers,
Mike