Powershell: Veeam B&R – Get total days before the license expires


So it’s time for a new post with some “traditional” Powershell so no snappins from VMware or Veeam. But first some background info. I am working for a Veeam ProPartner  with a Service Provider partner program. in this program Veeam only supplies “temporary licenses” so you have to deal with an expiration date of the license. This also applies to the Veeam NFR licenses for vExperts, VCP, MVP, etc. But how do you get notified when the license is about to expire? Well I don’t know if there is an option for that, maybe in the Enterprise Portal but as far as I know will it only display an error when the license key is expired.

I decided to dive under the hood and tried to find the places where Veeam B&R holds the license information. I couldn’t find the license info with the Veeam Powershell Toolkit. So the next step was to find the info inside the Veeam Backup Database but I couldn’t find it either inside the database. The last step was the right one. The license information is kept inside the Windows registry in the following key:

HKLM\SOFTWARE\VeeaM\Veeam Backup and Replication\license

But the info is saved in a REG_BINARY so it’s harder to extract. But lucky me Tim Dunn wrote a simple one-liner to extract this data. So I added this to my script:

$regBinary = (Get-Item 'HKLM:\SOFTWARE\VeeaM\Veeam Backup and Replication\license').GetValue('Lic1')
$veeamLicInfo = [string]::Join($null, ($regBinary | % { [char][int]$_; }))

The $regBinary variable gets the data from the registry key. The $veeamLicInfo variable converts the $regBinary into human readable lines of text. So now we extracted the license info, we only need write a RegEx to extract the info we need to create a notification e-mail. So take a look at the $pattern variable which will search for:
“EXPIRATION DATE=MM/DD/YYYY”

The $expirationDate variable will execute the RegEx and it saves the first match via [0]. After that the match will be splitted and the the value after the “=” character will be used as the expiration date.

So now we have the expiration date but how do we calculate the remaining days. Well that’s exactly what the code, that fills the $totalDaysLeft variable does.

So here you will find the complete script:

Warning: this script is only tested on Veeam Backup & Replication version 5. So I don’t know if the script will work on version 6 too.

Update: If you want to use the following script with Veeam Backup & Replication v6. You only have to change the $pattern variable to: $pattern = expiration date\=\d{1,2}\/\d{1,2}\/\d{1,4}

Update 2: It’s possible to read the version from the executable. So I created an updated version of the script that works with Veeam v5 and Veeam v6.x.

#http://blogs.msdn.com/b/timid/archive/2011/06/17/stupid-tricks-with-reg-binary-registry-data.aspx <- $regBinary trick
#http://stackoverflow.com/questions/622902/powershell-tips-tricks-for-developers <- regex

$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2
$returnStateUnknown = 3

$veeamExe = Get-Item 'C:\Program Files\Veeam\Backup and Replication\Veeam.Backup.Manager.exe'
$regBinary = (Get-Item 'HKLM:\SOFTWARE\VeeaM\Veeam Backup and Replication\license').GetValue('Lic1')
$veeamLicInfo = [string]::Join($null, ($regBinary | % { [char][int]$_; }))

if($veeamExe.VersionInfo.ProductVersion -match "6"){
    $pattern = "Expiration date\=\d{1,2}\/\d{1,2}\/\d{1,4}"
}
else{
    $pattern = "EXPIRATION DATE\=\d{1,2}\/\d{1,2}\/\d{1,4}"
}

$expirationDate = [regex]::matches($VeeamLicInfo, $pattern)[0].Value.Split("=")[1]
$totalDaysLeft = ((Get-Date $expirationDate) - (get-date)).Totaldays.toString().split(",")[0]
$totalDaysLeft = [int]$totalDaysLeft

if($totalDaysLeft -gt "14"){
    Write-Host "The Veeam License will expire in $($totalDaysLeft) days"
    exit $returnStateOK 
}
elseif($totalDaysLeft -ge "7"){
    Write-Host "The Veeam License will expire in $($totalDaysLeft) days"
    exit $returnStateWarning 
}
elseif($totalDaysLeft -lt "7"){
    Write-Host "The Veeam License will expire in $($totalDaysLeft) days" 
    exit $returnStateCritical 
}
else{
    Write-Host "Something went wrong...."
    exit $returnStateUnknown 
}

You can change the parameters of the Send-MailMessage and schedule a task op your Veeam server to report the total times left before the license will expire.

Advertisement

vSphere: VM “freezes” during the removal of a snapshot


If your VM is running on a NFS datastore and Changed Block Tracking (CBT) is enabled, you might experience the following symptoms:

When removing the snapshot of the virtual machine residing on the NFS storage in an ESX/ESXi 4.1 host, you may experience these symptoms:

  • The virtual machine appears to be in a hung state within the console view
  • The virtual machine stops responding to ping requests
  • The virtual machine is inaccessible via remote desktop

But why is this VM freezing? The explanation is the locking mechanism which NFS uses:

This issue may occur if you are using a backup application that utilizes Changed Block Tracking (CBT) and the ctkEnabled option for the virtual machine is set to true. The virtual machine becomes unresponsive for up to 30 seconds as NFS locks on the .ctk file are changed.

The workaround is to disable CBT:

  1. Wait for the virtual machine to become responsive and for the snapshot operation to complete.
  2. Schedule an outage window for the affected virtual machine.
  3. Shut down the virtual machine.
  4. In the Inventory pane, right-click the virtual machine and click Edit Settings.
  5. Click the Options tab and click General.
  6. Click Configuration Parameters.
  7. If the ctkEnabled  parameter is not listed, click Add Row, add ctkEnabled, and set it to false.
  8. Power on the virtual machine.

This workaround can impact the backup performance because you can’t use CBT. To Disable CBT in a Veeam job, you have to edit the job and disable CBT in the Advanced Settings under the vSphere tab:

image

Or if you’re using PHD Virtual Backup you can change the CBT settings in the Options tab on the properties page of a Backup Job:

image

 

Source  
http://kb.vmware.com KB1031106

Device eth0 has different MAC address than expected, ignoring.


After testing the Instant Recovery of a Linux web server. See my previous post about this Recovery process. The Linux web server has no network connection. I quick look at ifconfig only showed the loopback adapter. So I tried ifup eth0 and run into to following error:

image

This can simply be fixed by changing the MAC address. Open the Virtual Machine Properties and write down the MAC Address:

image

open the /etc/sysconfig/network-scripts/ifcfg-eth0 in your favorite editor and change the HWADDR to the new MAC address and save the file.

image

The final step is to restart networking via /etc/init.d/network restart.

Powershell: Script to Query the Veeam Backup database


image

Earlier this year I wrote a post about how to query the Veeam Backup SQL database to get the total job running time. I wanted to see if I was able to run this Query via Powershell. So I started to search on Google and I found a great series of articles on http://www.databasejournal.com about how to use Powershell to access Microsoft SQL databases. After reading part two, I was able to create a script to run my Query.

The only thing you have to change are the next three variables:

$dbServer = "servername\instance" 
$db = "VeeamBackup"
$veeamJob = "VeeamJobName"

 

Run the next script to query the Veeam Backup database and return the total job time.

$dbServer = "servername\instance"
$db = "VeeamBackup"
$veeamJob = "VeeamJobName"
$Query = "SELECT [job_name],CONVERT(char(10),[creation_time], 101) AS start_date `
,CONVERT(varchar, [creation_time], 108) AS job_start,CONVERT(char(10), [end_time], 101) AS end_date `
,CONVERT(varchar, [end_time], 108) AS job_end, `
LEFT(CONVERT(VARCHAR,CAST([end_time] AS DATETIME)-CAST([creation_time] AS DATETIME), 108),5) AS total_time `
FROM [VeeamBackup].[dbo].[BSessions] WHERE [job_name] = '$veeamJob' ORDER BY start_date"

$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server=$dbServer;Database=$db;Integrated Security=True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $Query
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
$DataSet.Tables[0] | Format-Table -AutoSize 

You can also find the script on poshcode.org: http://poshcode.org/1316

 

The script generate the following output:

image

Veeam Backup and Symantec Backup Exec side by side


imageimage

In this post I will show you how easy it is to run Backup Exec Job when Veeam Backup is ready with his job.

First you have to configure your backup job. The only thing different to the “normal” configuration is the Schedule tab. Set the job to Run now. Submit the job and cancel the job.

image

You will see the job under the Job Setup.

image

Now we’re going to test the job. Open a command prompt and run the following command:

“C:\Program Files\Symantec\Backup Exec\bemcmd.exe” -o01 -jJobName_Backup

image

If everything went ok, the Backup job should be running now.

More information about bemcmd.exe can be found here: http://seer.entsupport.symantec.com and in one of my earlier posts: backup-exec-start-a-backup-job-from-the-commandline

Now there is only one thing we need to configure in Veeam Backup. Open the Veeam Backup Job. Go to the Backup Destination window and click on Advanced.

image

Enable the Run the following command check box and enter the bemcmd.exe commando which we used earlier in the command prompt. After that, enable the Run every 1 backup cycle checkbox too.

image

Now you’re ready to go! When the Veeam Backup job is ready, it will start the Backup job of Symante Backup Exec and writes the Veeam Backup file to the tape drive.

Release: Veeam Backup 3.1.1.295


image

@Gostev has published the news on Twitter:

image

The Release Notes:

New Features
• Added support for replication and remote backup over slow and unreliable links with moderate packet loss.
Resolved Issues
• .NET Framework bug affecting some non-English locales (confirmed to exist on Norwegian locale) results in sporadic corruption of backup files chain (missing VBK files, extra VRB files).
• Backup file repair after unsuccessful backup cycle fails if backup storage is low on free disk space.
• Network backup in service console agent mode may fail with the following error: “Failed to validate command "dd if="/vmfs/volumes/…”.
• Attempting to enable SSH connection to ESX host on Japanese locale fails with the following error: ["Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "VeeamSSH.strings.ja.resources" was correctly embedded or linked into assembly "Veeam.SSH" at compile time, or that all the satellite assemblies required are loadable and fully signed."].
• Veeam VSS processing fails on specific OS configurations with various “Access denied” errors while specified VSS account has suffient permissions.
• Veeam VSS processing fails on specific OS configurations with the following error: "The specified service does not exist as an installed service".
• Veeam VSS integration does not support guests with Datacenter Edition of Microsoft Windows 2003.

You can download the new release here: http://www.veeam.com/vmware-esx-backup/download.html

Source: http://www.veeam.com/forums/viewtopic.php?f=2&t=1565

Disable Multipathing on a VCB Proxy


image

In my journey of tuning my VCB Proxy for the best performance. I came across this post on the Veeam forums by drbarker: http://forum.veeam.com/. In this post, he describes the steps to be taken, if you want to disable multipathing on your VCB Proxy:

1. Log on to your VCB proxy as a user with administrative privileges.

2. Click Start. Right-click My Computer in the Start menu and select  Manage. The Computer Management window opens.

3. In the Computer Management window, select Storage > Disk Management.

If the Initialize and Convert Disk Wizard opens, close it.
The lower-right portion of the Computer Management window displays a list of all disks visible to the system.

Inactive paths to disks are indicated by a No Entry icon placed over the disk.

image

4. To disable an inactive path, right-click its icon and select Properties from the context menu. The Disk Drive Properties dialog box opens.

image 

5. On the General tab, change the value for Device usage to "Do not use this device (disable)." This removes the disk from the list of devices presented by Disk Management.

image

6. Repeat Step 4 and Step 5 for all inactive paths.

Veeam: Backup 2.0 released


Versie 2.0 bevat de volgende nieuwe features:

  • Five times faster – Veeam Backup 2.0 has a new optimized backup engine, which allows for up to five times faster backup and replication performance than the previous version.
  • Windows Volume Shadow Copy Service (VSS) support – Veeam Backup 2.0 leverages VSS to ensure consistent backup and recovery of VSS-aware applications, including Active Directory, Microsoft Exchange and Microsoft SQL Server.
  • ESXi support – Now customers can back up ESXi servers using VMware Consolidated Backup (VCB). File-level recovery is fully supported for guests running on ESXi, and full image restore is supported to ESX 3.x servers. These images can then be VMotioned to ESXi as needed.
  • Enhanced reporting and notification – Comprehensive real-time job statistics are available, including automated e-mail notification of backup job status, activity and performance details.
  • Backup portability – Veeam Backup users can now easily import backups made using previous versions of the software, or backups that have been archived to tape.
  • Support for third-party tape backup systems – Now users can specify a script to automatically run when the VMware backup is finished, initiating tape backups to begin.

 

Veeam heeft ook een demo van Veeam Backup online staan. Deze kun je via de volgende button opstarten:image

Meer informatie vind je hier: http://www.veeam.com/vmware-esx-backup.html

Veeam: Backup for VirtualInfrastructure


Features and Benefits

Backup and Replication in one – Now, with Veeam Backup, organizations can benefit from a unified solution for both backup and replication to protect mission-critical virtual machines from both hardware and software failure.

Fast file-level recovery – Veeam Backup’s fast file-level recovery feature allows ESX administrators to restore individual files in minutes without extracting the full VM image to a local drive. An administrator can extract individual files to the latest state or to a specific point in time.

Data de-duplication – Veeam Backup allows you to minimize storage costs for virtual machine backups. Veeam’s data de-duplication and compression are especially valuable when backing up multiple virtual machines created from a single template or VMs with gigs of free space on their logical drives.

Replication rollback – A replica produced with Veeam Backup can be restored to a particular point in time. This protects your infrastructure against both hardware and software corruptions.

Integration with VCB – Veeam Backup is the only backup solution that enables you to run incremental backup and replication jobs through VMware Consolidated Backup (VCB). Using its proprietary “VCB on-the-fly” technology, Veeam Backup doesn’t require extra space on the VCB proxy for VM images, allowing for faster backups. Veeam Backup operates either with or without VCB, letting the user choose whether to use VCB or not for either standard backup or replication backup.

Integration with Veeam FastSCP – To date, Veeam’s FastSCP freeware has been downloaded more than 28,000 times, and Veeam Backup shares a common interface with FastSCP, allowing users to manage backup, replication and file copying from a single screen.

 

Hieronder plaats ik wat printscreens van het product.

Het beginscherm:

veeam_Backup_1

De backup wizard:

veeam_Backup_2

De Restore Wizard.

veeam_Backup_3

Meer info en een demo filmpje vind je hier: http://veeam.com/vmware-esx-backup.html

En nog een filmpje van Veeam @ VMworld Europe 2008