Veeam Whiteboard and PowerShell

talkbubbleI’ll be live next week talking about PowerShell principles and concepts as part of the Veeam Whiteboard series. Should be a lot of fun.  I hope you’ll catch it live or on demand. You can learn more and register for free at http://www.veeam.com/veeamlive/powershell-paradigm-principles-practice.html

PowerShell for Newbies

As you might imagine I get a lot of questions about how to get started with PowerShell, especially what books and material they can get their hands on. While I earn living creating books, training videos and offering live training, I’m aware that many people are on a budget so if you are looking for a free resource, allow me to direct you to an ebook/white paper I wrote for Veeam last year titled PowerShell for Newbies: Getting Started with PowerShell 4.0.

This is a 30 page crash course on everything I think you need to get started with PowerShell. There’s no way you can learn PowerShell in 30 pages, but this should get you started on the right path. I’d love for you to get a copy and let me know what you think. Head over here to grab your copy. You will need to register to download the paper. When you are finished come back here and take a look at my Books and Training page for your next steps.

Enjoy.

Easy VM Backup with Veeam Zip

If you run a small VMware or Hyper-V setup, perhaps for a lab or personal training, you probably haven’t thought to much about backing up your virtual machines. But it is actually pretty easy and doesn’t cost anything. Let me give you a quick intro to the free backup tool from Veeam. The first thing you need to do is download it. The install is pretty straightforward so I’ll skip that part.

When you fire it up for the first time you’ll see a tree for VMware and Hyper-V. This product works for both! Right-click on whichever virtualization infrastructure you are using and add a server. It is a quick and easy wizard that should only take a minute to complete. The app should automatically enumerate all the virtual machines.

veeam-backup-1

To create a backup right-click on a virtual machine and select Veeam zip, or you can use the menu icon. You will be ask to provide a path for the backup.

veeam-backup-2

The program will create a single zip file of all associated files for the virtual machine. It takes a few minutes for the backup to get up to speed.

veeam-backup-3

Eventually my backup reached 24MB/second. When the backup finishes you can view a status report by going to History and then right-clicking on the backup. You can view stats.

veeam-backup-4

Or a summary report as an HTML file in your browser

veeam-backup-5

All of the files will be stored in a vbk file. This is a zip file format. You can extract files locally, or leave it alone until you need to restore something.

There are some limitations, but remember this is a free tool not a free trial. There’s no PowerShell support and it doesn’t support Hyper-V on Windows 8. Those are biggies for me. Of course Veeam has a full-blown backup product that you should try out, especially if you like the idea of managing backups via PowerShell.

I’ll cover some additional features in future posts.

Running Veeam Jobs

I’m still fighting hardware issues with my ESX box (among other things) but I wanted to jot down some more notes on my experiences with PowerCLI and the Veeam backup cmdlets. Last week I wrote about how I created multiple backup jobs with a one line PowerShell expression.  After the jobs were created I needed to run them. For performance purposes I only wanted to run one at a time but I obviously wasn’t going to sit up all night staring at a computer screen.

My answer was to use Veeam’s Start-VBRJob cmdlet. The cmdlet takes a job name as a parameter, which you can pipe to it. All I needed was a collection of job names. I created an empty array, $jobs and then added one job that I knew I still needed for a VM on another datastore. The other new jobs were for VMs on datastore2. Using Get-VBRJob I retrieved all my Veeam jobs, piped them to Where-Object to filter out all jobs except those where the TargetDir property was G:\Datastore2, since I had all my datastore2 jobs backing up to the same location. For each matching backup job, I added the job name to the $jobs array.


Now that I had a collection of jobs, all that was left was to pipe it to Start-VBRJob.

PS C:\> $jobs | Start-VBRJob

The jobs run synchronously and you won’t get your PowerShell prompt back until all the jobs have finished which could be several hours. I was going to let it run overnight so it didn’t matter. But next time I would use a PowerShell job and let this run in the background.


VMware Backup with PowerCLI and Veeam

My primary backup drive for my virtual machine backup toasted on me so I had to recreate all of my backup jobs. I’ve been using Veeam’s backup product for VMware and it couldn’t be easier to use. I’ve known that it included a set of PowerShell cmdlets but I had never really looked at them before.  I decided this would be a great opportunity.

One of my backup goals, that I’ll describe today, was to grab all VMs in a particular datastore and backup them up to a local external drive. The current version of Veeam doesn’t allow you to specify a datastore as a container. Although I didn’t use it, you are supposed to be able to specify an ESX host, which will back up all machines. Or you need to specify a comma separated list of virtual machines. In my case, I wanted all VMs on datastore2. But what are they? PowerCLI to the rescue. First off, your VM host must be connected and not in maintenance mode. For my purposes, I like having the virtual machines themselves powered off. Using Get-VM I can find all machines on the required datastore.

PS C:\> get-vm -Datastore datastore2

Name                 PowerState Num CPUs Memory (MB)
—-                 ———- ——– ———–
MyCompany Windows 7  PoweredOff 1        512
R2 Core RODC         PoweredOff 1        1024
MyCompany Vista      PoweredOff 1        768
MyCompany XP         PoweredOff 1        384
MyCompany2003        PoweredOff 1        384
Research Member S… PoweredOff 2        1024

All I need are the names so I pop them into a variable.

PS C:\> get-vm -Datastore datastore2 | foreach {$v+=$_.name}
PS C:\> $v
MyCompany Windows 7
R2 Core RODC
MyCompany Vista
MyCompany XP
MyCompany2003
Research Member Server R2

Armed with this I can now invoke the Add-VBRBackupJob cmdlet from Veeam.

PS C:\> Add-VBRBackupJob -Name "Dstore2_Backup" -Type VDDK –mode "san;nbd" –Folder "g:\datastore2" -objects $v -host "My Computer" –FileName "dstore2"

This command will create a backup job called Dstore2_Backup using the VMware vStorage API to backup all VM objects to G:\Datastore2 on “My Computer”.  As I continue to poke around with these cmdlets, I’ll be sure to share.