PowerShell script exchange
Post Reply
johannesk
Enthusiast
Posts: 78
Liked: 16 times
Joined: Jan 19, 2016 1:28 pm
Full Name: Jóhannes Karl Karlsson
Contact:

Powershell script for configuration backup

Post by johannesk »

Hi,

Does anyone here have a ready to use powershell script that can be scheduled to run a configuration backup of Veeam?

I then want to run it two times a day, each time targeting different storage location.

anyone?

Regards,
Jóhannes

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

Re: Powershell script for configuration backup

Post by jhoughes » 3 people like this post

You can run it with this code for each run, with examples for morning & evening, you will just need to adjust the first line to set each run to the appropriate repository.

Morning, 8AM example:

Code: Select all

$Repo = Get-VBRBackupRepository -Name '%reponame%'
$morningoptions = New-VBRDailyOptions -Type Everyday -Period 8:00
$morningschedule = New-VBRConfigurationBackupScheduleOptions -Type Daily -DailyOptions $morningoptions
Set-VBRConfigurationBackupJob -Repository $Repo --ScheduleOptions $morningschedule
Start-VBRConfigurationBackupJob
Evening, 8PM example:

Code: Select all

$Repo = Get-VBRBackupRepository -Name '%reponame%'
$eveningoptions = New-VBRDailyOptions -Type Everyday -Period 20:00
$eveningschedule = New-VBRConfigurationBackupScheduleOptions -Type Daily -DailyOptions $eveningoptions
Set-VBRConfigurationBackupJob -Repository $Repo --ScheduleOptions $morningschedule
Start-VBRConfigurationBackupJob
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion

nielsengelen
Veeam Software
Posts: 4168
Liked: 856 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Powershell script for configuration backup

Post by nielsengelen » 1 person likes this post

You can change these via the built-in commands for configuration backup. You can then use Windows Task Manager to create a task to run the script when needed. Most likely it will be easier to create 2 separate scripts instead of 1 big script.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen

johannesk
Enthusiast
Posts: 78
Liked: 16 times
Joined: Jan 19, 2016 1:28 pm
Full Name: Jóhannes Karl Karlsson
Contact:

Re: Powershell script for configuration backup

Post by johannesk »

Thanks Joe Houghes,

I'll give this a try - it seems to be exactly what I was looking for.

Regards,
Jóhannes

Leo0601
Novice
Posts: 4
Liked: never
Joined: Oct 13, 2020 1:40 pm
Full Name: Leo
Contact:

Need Powershell script for configuration backup in veeam 9.5 GA

Post by Leo0601 »

Hello,

I am going to uninstall veeam 9.5 and install the veeam 10 in the same server. Before going to uninstall the veeam 9.5, I need to take the configuration full backup and once after I complete the new installation of veeam 10. I have to restore the configuration backup in veeam 10.

So I need powershell script which take the configuration full backup in veeam 9.5.

Does anyone here have a ready to use powershell script that can be scheduled to run a configuration backup of Veeam 9.5 GA?

If anyone has please kindly share it here.

Thanks in advance.

Regards,
leo.

chris.arceneaux
Veeam Software
Posts: 367
Liked: 201 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Kentucky, USA
Contact:

Re: Powershell script for configuration backup

Post by chris.arceneaux »

Hi Leo,

Veeam provides PowerShell cmdlets to do that. The Start-VBRConfigurationBackupJob cmdlet is what you're looking for. It will kick off a configuration backup.

With that said, you won't be able to restore a configuration backup generated with v9.5 GA in v10. Per Veeam documentation, you must be running version 9.5 Update 3 or later. As such, you'll need to upgrade your current instance before proceeding.

bwisdom
Lurker
Posts: 2
Liked: never
Joined: Sep 30, 2020 5:25 pm
Full Name: Bobby Wisdom
Contact:

Re: Powershell script for configuration backup

Post by bwisdom »

If it would be better I can post this as a seperate post, but since this was here, I thought I would try this first.

How do the config backups work in terms of rollups? My boss keeps 30 days of configs and wants me to ship them off to azure. So Ill be removing the 30th and then adding in the new one with my script. Is it ok to just remove and add or is there some kind of rollup involved that I need to take into account?

ithark
Influencer
Posts: 22
Liked: 4 times
Joined: Sep 30, 2020 11:22 am
Full Name: Karthik
Contact:

Re: Powershell script for configuration backup

Post by ithark »

Hi Joe Houghes,
Good Day!
We also had a similar requirement for the config backup and we thought your script was just perfect for our needs.
But there is just onething which isn't working properly.
When we manually run the script it works like a charm but when the script is executed via the Task Scheduler, the config backup is always backed up to a single repository.
May I know if we are missing something here?
Thanks in advance!
Regards,
Karthik
Regards,
Karthik

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

Re: Powershell script for configuration backup

Post by jhoughes »

The sample code I gave was meant to have the repository name set for each run of the script.

Did you set the name correctly?
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion

ithark
Influencer
Posts: 22
Liked: 4 times
Joined: Sep 30, 2020 11:22 am
Full Name: Karthik
Contact:

Re: Powershell script for configuration backup

Post by ithark »

Hi Joe,
Yes. As I mentioned, it runs fine if I run the script manually. But if it runs via the Task scheduler, the repository doesn't changes.
Regards,
Karthik
Regards,
Karthik

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

Re: Powershell script for configuration backup

Post by jhoughes »

Please post the code that you are running with Task Scheduler.
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion

ithark
Influencer
Posts: 22
Liked: 4 times
Joined: Sep 30, 2020 11:22 am
Full Name: Karthik
Contact:

Re: Powershell script for configuration backup

Post by ithark »

Hi Joe,
It is resolved. I used the Clear-Variable in the script to delete the value of $Repo in both the script. Now it is running fine as expected.
Many thanks.
Regards,
Karthik
Regards,
Karthik

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests