Comprehensive data protection for all workloads
Post Reply
MartinaV
Novice
Posts: 4
Liked: 1 time
Joined: Feb 06, 2021 11:32 am
Contact:

pre-job script hangs

Post by MartinaV »

good morning forum,
I recently installed Veeam B&R and I am doing the first tests backing up a VM running on an ESXI host. Works fine.
However, there is a database running on my VM, which has to be stopped first.
I found Mark Russinovich's PStools, and made a .bat file like:
psservice64 \\<IP of VM> -u <user> -p <password> stop <name of service1>
psservice64 \\<IP of VM> -u <user> -p <password> stop <name of service2>
exit

running this .bat from a command prompt works fine, as well as invoking the .bat by double click:
Both services on my remote VM will be stopped.
However, invoking this .bat as a pre-job script within Veeams backup job does not work.
after executing the backup job, action window shows: 'job started', thats all! Even after waiting several minutes, nothing more happened, and the services of my VM are still running.
After stopping the job, the next message is:
Error running pre-job script: operation was canceled by user....

--
Unfortunately I am not an IT pro.... seems like I am just too stupid?
Thanks for any help!
Martina
Egor Yakovlev
Product Manager
Posts: 2581
Liked: 708 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Location: Prague, Czech Republic
Contact:

Re: pre-job script hangs

Post by Egor Yakovlev »

Hi Martina.

- Make sure script has a valid exit code. Veeam expects "0" to be returned back if script runs successfully, and if there is none, we treat it as "still running".
- Make sure about permissions, as script runs under Veeam service account, not your currently logged in user(aka double click test ain't identical).

/Hope that helps!
MartinaV
Novice
Posts: 4
Liked: 1 time
Joined: Feb 06, 2021 11:32 am
Contact:

Re: pre-job script hangs

Post by MartinaV »

Hi Egor,
thanks for your answer!
Now I added exit/B 0 as last line into my batch, but exit code alone cannot be the (only) problem.
It looks as if the script will never be executed, otherwise first the db services on remote VM should stop, and THEN Veeam should hang.
Services are not stopped however.
Permission, uh...
under PROPERTIES->security of the .bat now I gave 'full access' to all existing entries (administrators/users/system/ authentified users). Anyway still the same situation.
My pdf sits on D: partition, not on system partition.

as a next step I made a simple pre-job script containing
exit /B 0
only.
Now, veeam executes the script, it ends immediately and the backup job works ok!

So, it seems that my psservice commands do not execute nor give control back.
Hopefully there is an idea how to solve the problem! Thank you!
Egor Yakovlev
Product Manager
Posts: 2581
Liked: 708 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Location: Prague, Czech Republic
Contact:

Re: pre-job script hangs

Post by Egor Yakovlev »

For the sake of credentials test, give your psservice64 strictly defined [-u username] [-p password] parameters inside the script text.
Also wondering, why psservice instead of remote powershell?
MartinaV
Novice
Posts: 4
Liked: 1 time
Joined: Feb 06, 2021 11:32 am
Contact:

Re: pre-job script hangs

Post by MartinaV »

I do have credentials within my script from the beginning.
Why no powershell? Missing skills! :-(
OK, I did read the whole the internet (well, almost...) since your last post about remote powershell. No success after many tries.
Test-Wsman <IP> works
Get-Service -Name W32Time -computername <IP> does not find this service, or any other service.
Enter-PSsession ..... -credentials.. asks for password, but then sais that on the remote PC, my Veeam machine has to be added to trustedhosts. I did. Anyway no success.
Firewalls are off.
What a sad story, and sorry to all for spoiling this forum with a dummie's off-topic issue!
soncscy
Veteran
Posts: 643
Liked: 312 times
Joined: Aug 04, 2019 2:57 pm
Full Name: Harvey
Contact:

Re: pre-job script hangs

Post by soncscy » 3 people like this post

Why a pre-job script? For VMs, there are pre-freeze and post-thaw scripts that trigger before/after the snapshot and trigger inside the GuestOS itself instead of doing so remotely.

Set it in the Guest Processing section and Veeam will toss the script onto the guestOS and execute it there. You don't need to mess with remoting! ;)
MartinaV
Novice
Posts: 4
Liked: 1 time
Joined: Feb 06, 2021 11:32 am
Contact:

Re: pre-job script hangs

Post by MartinaV » 1 person likes this post

YOU MADE MY DAY!
Works fine. Thanks!!
soncscy
Veteran
Posts: 643
Liked: 312 times
Joined: Aug 04, 2019 2:57 pm
Full Name: Harvey
Contact:

Re: pre-job script hangs

Post by soncscy » 3 people like this post

<3 Oh I'm glad it worked! Indeed, sometimes it's just that simple, and we all walk down that path sometimes :D
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 91 guests