PowerShell script exchange
Post Reply
vraengmose
Influencer
Posts: 11
Liked: 1 time
Joined: Jun 18, 2019 9:46 am
Full Name: Thomas Trolle Vrøngmose
Contact:

SureBackup job with random VM through PowerShell

Post by vraengmose » Jul 05, 2019 12:53 pm

Hi

I am looking for a good way to test our backups on a monthly schedule task, with random VM selection dievideng them op ind to different application groups like:

Domain Controller SureBackupTest
File leve SureBackupTest
Disaster Recovery SureBackupTest
SQL SureBackupTest

With different setting on the application group. Anybody who tried something similar to this?

i looked ad post: veeam-backup-replication-f2/surebackup- ... 30402.html

Code: Select all

$NumberofVMs = 10
$AppGroupName = "Dynamic App Group"
$SbJobName = "Dynamic Surebackup Job"
$SbJobDesc = "Dynamic App Testing"
 
asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue
 
# Find all VM objest successfully backed up in last 1 days
$VbrObjs = (Get-VBRBackupSession | ?{$_.JobType -eq "Backup" -and $_.EndTime -ge $Date.adddays(-1)}).GetTaskSessions() | ?{$_.Status -eq "Success" -or $_.Status -eq "Warning" }
 
# Select random VMs to be tested
$TestVMs = $VbrObjs | Get-Random -Count $NumberofVMs
 
# Remove the old App Group
Remove-VSBJob -Job (Get-VSBJob -Name $SbJobName) -Confirm:$false
Remove-VSBApplicationGroup -AppGroup (Get-VSBApplicationGroup -Name $AppGroupName) -Confirm:$false
 
# Create the new App Group, SureBackup Job, Start the Job
$VirtualLab = Get-VSBVirtualLab -Name "Surebackup Lab”
$AppGroup = Add-VSBViApplicationGroup -Name $AppGroupName -VmFromBackup (Find-VBRViEntity -Name $TestVMs.Name)
$VsbJob = Add-VSBJob -Name $SbJobName -VirtualLab $VirtualLab -AppGroup $AppGroup -Description $SbJobDesc

Start-VSBJob -Job $VsbJob -RunAsync

But the can't get it to work. Maybe i need more powershell skilles :wink:

jhoughes
Veeam Software
Posts: 91
Liked: 21 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
Contact:

Re: SureBackup job with random VM through PowerShell

Post by jhoughes » Jul 05, 2019 12:57 pm 1 person likes this post

Start with reading this blog from Luca, it should help.

https://www.virtualtothecore.com/can-te ... urebackup/
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | vExpert | Cisco Champion | Tech Field Day Delegate | VCP 4/5/6 | VCP6-NV | VMware/Cisco UCS/Powershell/VEEAM Enthusiast

vraengmose
Influencer
Posts: 11
Liked: 1 time
Joined: Jun 18, 2019 9:46 am
Full Name: Thomas Trolle Vrøngmose
Contact:

Re: SureBackup job with random VM through PowerShell

Post by vraengmose » Jul 08, 2019 8:30 am

Thanks Joe!

I am already started testing script and looking ind to modifying it for our needs.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests