How to list Veeam VM backups with PowerShell? Recently I came across a use-case where you may want to list out all of the Virtual Machines (VMs) backed up with Veeam. If you have multiple Veeam servers that backup 100’s of VMs, creating a list of VMs and which server has their backups is useful. Additionally, that list could be searched or passed off to another team to do file restores. Instead of paying for VeeamOne to do this for you, this can be accomplished with PowerShell.

After some digging, I found a script on the Veeam forum that got me started here. That script gave me a little too much information, all I’m looking for is all the VMs and what job they are under. I trimmed the script and added an export to .csv; this is what I came up with.

asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue 

foreach($Job in (Get-VBRJob))
	{
	$Session = $Job.FindLastSession()
	if(!$Session){continue;}
	$Info = $Session.GetTaskSessions()
	$allObjectsInJobs = ($info | ForEach-Object {$_} |
	Where-Object {$_.status -eq "Success" -or $_.status -eq "Warning" -or $_.status -eq "Failed" -or $_.status -eq "InProgress"}) |
	Foreach-object {$_ | Select-Object @{Name="Job";Expression={$Job.Name}}, 
		@{Name="VM";Expression={$_.Name}}| Format-List | Out-String}
	Write-Output $allObjectsInJobs | Out-File 'c:\temp\temp.csv' -encoding ascii -Append -NoNewline
	} 

Get-Content 'c:\temp\temp.csv' | Where { $_.Replace(",","") -ne "" } | Out-File 'c:\temp\VeeamVMsBackedUp.csv'
Remove-Item 'c:\temp\temp.csv'

The last part where the script creates a temp.csv is because I was getting 3-4 blank rows in the first csv file. The replace command removes that, exporting the final product to “VeeamVMsBackedUp.csv”.

That should help anyone to list Veeam VM backups with PowerShell.

Check out my last Veeam post here.

You can get Veeam here.

Enter your email address to subscribe to this blog and receive notifications of new posts!

People get crypto to read and post blogs. Publish0x is like Medium but the author and reader get tips. Use my referral link below and check it out.

God bless you!

Published by Powersjo

If you want to contact me I can be found here: https://gab.com/Powersjo Christ is King