PowerShell script exchange
Post Reply
rohit.solorion
Lurker
Posts: 2
Liked: never
Joined: Mar 14, 2020 10:47 pm
Full Name: Rohit Kumar
Contact:

Schedule powershell script after backup job completion

Post by rohit.solorion »

Hi,

There is production SQL DB being backed-up by Veeam (daily). We have created a powershell script to restore the production db to another SQL instance (development DB). Now our requirement is to schedule the restore script to run after successful completion of production DB backup job. Is it possible to do using Veeam backup job?
I already check 'post-thaw' option in script section under AAP section, but the documentation says the 'post-thaw' will execute the script once VM snapshot is complete. But our requirement is to run the powershell script after successful completion of SQL DB backup job. Thank you in advance for your suggestions.
Support case id= 02155342
chris.arceneaux
VeeaMVP
Posts: 668
Liked: 359 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Georgia, USA
Contact:

Re: Schedule powershell script after backup job completion

Post by chris.arceneaux »

Hi Rohit,

What you're looking for is a 'post-job' script:

https://helpcenter.veeam.com/docs/backu ... ts_vm.html

Image
rohit.solorion
Lurker
Posts: 2
Liked: never
Joined: Mar 14, 2020 10:47 pm
Full Name: Rohit Kumar
Contact:

Re: Schedule powershell script after backup job completion

Post by rohit.solorion »

Thank you for your quick reply. I tried this option, but there seems permission issue.

As per documentation- The scripts are executed on the backup server under the account under which the Veeam Backup Service runs (the local System account or account that has the local Administrator permissions on the backup server).

In our case, the Veeam backup service is being run by local user, but we have configured restore script to be used by different AD User- 'sql_restore', this user has local Administrator permissions on Veeam B&R server & required permissions on target SQL instance for db restore. Script has been tested & running fine but when I give the script in backup job, it return error
"25/06/2020 16:26:35 :: Post-job script terminated with exit code 1 "

I am trying to check how to upload screenshot to this post. Is it with 'Insert image'?
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Schedule powershell script after backup job completion

Post by jhoughes » 1 person likes this post

One of the easiest ways to handle this, if you don't know how to configure the script to run with different credentials, it to take your running script and create a scheduled task for it on the VBR server (set to run as the appropriate 'sql_restore' account that you need it to).

Test this all and confirm that it is working, then your post-job script can be a simple script which only fires off the pre-configured scheduled task.
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests