Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Running Veeam Jobs

Posted on July 12, 2010

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.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

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.

PS C:\> $jobs=@()

PS C:\> $jobs+="MyCompany Exchange 2007"

PS C:\> Get-VBRJob | where {$_.targetdir -eq "g:\datastore2"} | foreach {$jobs+=$_.name}

PS C:\> $jobs

MyCompany Exchange 2007

MyCompany Windows 7

R2 Core RODC

MyCompany Vista

MyCompany XP

MyCompany2003

Research Member Server R2

PS C:\> 

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.


Behind the PowerShell Pipeline
Start-job -name "VeeamBack" -scriptblock {$jobs | Start-VBRJob}

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d