Hi @mvandek2 - that’s great to hear you were able to find/create a script which works for you. So, to clarify your process → did you use an Agent job in Veeam Backup? And, you placed your script in the Job settings to have a pre/post-JOB script?
Also, if any of our comments helped you in any way, please don’t forget to select one as ‘Best Answer’ so others with a similar issue who come across your post may benefit.
Best!
I only use VBR and OpenVPN to backup external servers, no agent, however, I see Veeam installing “Veeam Backup Transport” and “Veeam Installer service” being pushed to the remote systems; that's unexpected and a pitty from my perspective (less software is better).
As said, I cannot get pre- and post scripts to work at all, all automation is run via a single Powershell script, fortunately.
Those 2 services are a requirement to complete backups properly. If you want to know more about the transport service you can read here - Veeam Data Mover Service - User Guide for VMware vSphere
@mvandek2 - oh, ok. So no Agent, but just Veeam Backup. Good to know. Yes, for any systems you backup with VBR, so Veeam can process the systems and transport backed up data to Repositories, it has to deploy and use those services to do the tasks it needs to perform. I understand your concern, but those services are small and I have yet to hear about them causing issue in the long time I’ve been using Veeam.
Hi @mvandek2 - that’s great to hear you were able to find/create a script which works for you. So, to clarify your process → did you use an Agent job in Veeam Backup? And, you placed your script in the Job settings to have a pre/post-JOB script?
Also, if any of our comments helped you in any way, please don’t forget to select one as ‘Best Answer’ so others with a similar issue who come across your post may benefit.
Best!
I only use VBR and OpenVPN to backup external servers, no agent, however, I see Veeam installing “Veeam Backup Transport” and “Veeam Installer service” being pushed to the remote systems; that's unexpected and a pitty from my perspective (less software is better).
As said, I cannot get pre- and post scripts to work at all, all automation is run via a single Powershell script, fortunately.
Hi @mvandek2 - that’s great to hear you were able to find/create a script which works for you. So, to clarify your process → did you use an Agent job in Veeam Backup? And, you placed your script in the Job settings to have a pre/post-JOB script?
Also, if any of our comments helped you in any way, please don’t forget to select one as ‘Best Answer’ so others with a similar issue who come across your post may benefit.
Best!
Cannot get Veeam pre- and postscripting to do anything.
I now applied a Powershell script to do
- enable the NIC
- connect the VPN to the external server
- run the VBR backup job to backup the external server
- disconnect VPN
- disable the NIC
for multiple backup jobs.
This way I only have to use VBR for backing up and have all jobs running in one script independent of Veeam.
Glad you got it working with PS. That is my go to for scripting.
Cannot get Veeam pre- and postscripting to do anything.
I now applied a Powershell script to do
- enable the NIC
- connect the VPN to the external server
- run the VBR backup job to backup the external server
- disconnect VPN
- disable the NIC
for multiple backup jobs.
This way I only have to use VBR for backing up and have all jobs running in one script independent of Veeam.
Here are a couple of sites to help:
https://www.veeam.com/kb2183
And, the exit code isn't Veeam related...it's from the script file type (pretty sure). Here are codes for batch files:
https://www.geeksforgeeks.org/batch-script-return-code/
The best way to test your script is to 1st run it alone on the device or similar device but a test one, to see if it runs as expected; then place it in Veeam.
Break your total process up in layers & make sure things are successful in part. Then place it all together and attempt to run it wholistically.
Yes, I am looking for examples because I cannot get the simplest .bat file to do anything.
Try looking in the Backup Job log to see if it shows anything on why the Script isn’t (seemingly) doing anything. It should be on the VBR Server at:
C:\ProgramData\Veeam\Backup\<job-name>.log
It gives me exactly the same information:
p14.06.2024 23:29:06.557] <01> Warning (3) Pre-job script terminated with exit code 3
Yes, I am looking for examples because I cannot get the simplest .bat file to do anything.
Try looking in the Backup Job log to see if it shows anything on why the Script isn’t (seemingly) doing anything. It should be on the VBR Server at:
C:\ProgramData\Veeam\Backup\<job-name>.log
Any .bat file I configure as pre script gives errors or hangs without any feedback.
Why is this so complicated...
Yes, I am looking for examples because I cannot get the simplest .bat file to do anything.
As Shane mentioned there are no examples of scripts unless someone else has posted something.
Yes, I am looking for examples because I cannot get the simplest .bat file to do anything.
Are you wanting examples of scripts? Veeam doesn't provide examples, just where to place them.
Thanks but the link you sent does not contain any examples, am I missing something?
HI @mvandek2 -
You can run pre/post scripting for Agent jobs only if you use VBR to do the backup of the computer (i.e. Management of the Agent through VBR). See:
https://helpcenter.veeam.com/docs/backup/agents/agent_job_advanced_scripts.html?ver=120
and here:
https://helpcenter.veeam.com/docs/backup/agents/agent_job_vss_scripts.html?ver=120
Doing an Agent for Windows Standalone doesn’t allow pre/post scripting.
You can use any script type… .bat, .ps1, .vbs, etc. Guest processing side scripts only are for guest OS quiescing, so scripting there would be no use for that area of scripting. I think you should be able to do what you want with the Agent Job Scripting though. You'll just need to test it out. The script needs to run on the Backup Server itself, in any location you decide. Then in the Job settings > Storage section > Advanced button, Scripts tab enter the location of the script, as the example shows in the 1st link above.
Hope that helps.
Hmm..well, what you could do is use VBR to ‘push’ an Agent to the remote system, run a few or more backups, see how long it takes, then take the longest time and add additional time then run your script. You can do a pre/post script...although don’t recall if those are available for Agent-based jobs off hand.
Pre/post scripts sounds great, however, a simple batch file syntax containing “cmd.exe” doesn't do anything, Googling this is very discouraging.
Can you point me to some examples?
Hmm..well, what you could do is use VBR to ‘push’ an Agent to the remote system, run a few or more backups, see how long it takes, then take the longest time and add additional time then run your script. You can do a pre/post script...although don’t recall if those are available for Agent-based jobs off hand.
It is no problem to control LAN and VPN connections to remote servers and back them up, this way we are independent of the remote server and have total, local control. Only thing is that we give the backup job a time window longer than necessary, I'd like to bring that down to the minimum.
Perhaps I can use the build-in powershell interface in VBR to kill the connection as soon as the job is done.
Yes the PowerShell interface is more powerful and would be something to explore for sure.
It is no problem to control LAN and VPN connections to remote servers and back them up, this way we are independent of the remote server and have total, local control. Only thing is that we give the backup job a time window longer than necessary, I'd like to bring that down to the minimum.
Perhaps I can use the build-in powershell interface in VBR to kill the connection as soon as the job is done.
I would prefer to keep everyting on our local backup server so we can close down the connection when finished. If I run the client on the remote server I don't know when the close the VPN connection and (disable the NIC).
Then you would be better off running VBR on the server and deploying the Agent to the remote server. I get the scripting part but it will take longer to fiddle with this part versus going the easy route. You can create a backup job on the VBR server for the Agent including running scripts before/after to accomplish some of the tasks.
I would prefer to keep everyting on our local backup server so we can close down the connection when finished. If I run the agent on the remote server I don't know when to close the VPN connection (and disable the NIC).
Thanks, the agent provided the commandline functionality but this is for the agent. It look like this needs to run on the target system, not on the VBR server.
My idea was to create a single batchfile on the backup server to
- enable the NIC
- connect the VPN to the external server
- run the VBR backup job to backup the external server
- disconnect VPN
- disable the NIC
This to minimize the connection time with the external system.
Therefore I need to run the command for the backup (3.) from the backup server, not the external server.
Yes has to be on the system you want to back up. If you are looking at backing up remote systems then VBR is the way from this server and you could deploy the Agent to the remote server.
Thanks, the agent provided the commandline functionality but this is for the agent. It look like this needs to run on the target system, not on the VBR server.
My idea was to create a single batchfile on the backup server to
- enable the NIC
- connect the VPN to the external server
- run the VBR backup job to backup the external server
- disconnect VPN
- disable the NIC
This to minimize the connection time with the external system.
Therefore I need to run the command for the backup (3.) from the backup server, not the external server.
Yes, I installed VBR and not the agent on the Windows 2022 server.
I guess I need to install an agent on this system as well?
You don’t really need Veeam Community Edition installed...just the Agent for Windows if you’re just wanting to backup just that Win 2022 server.