Script After Replication Job Not Running

VMware specific discussions

Script After Replication Job Not Running

Veeam Logoby homerjnick » Thu Oct 20, 2016 8:33 am

Before I log a support call am I missing something here?

My last replication job of the night has a setting to run a batch file that invokes a PowerCLI PowerShell script to shut down all our Veeam Proxies.

Double-clicking the batch file on the Veeam Server does indeed shutdown our Veeam Proxies yet when the replication job finished last night I notice this morning all the Veeam Proxies are still up.

Here is my settings:

Image

The script is on the Veeam B&R server. I'm a bit confused as to why this did not work, heck it is a simple thing, run a batch file on the Veeam server that runs a PowerShell script that simply does a Stop-VM for my Veeam Proxies...all works when I double-click the batch file.

The job results show the script ran successfully:

Image

As I say, these scripts reside on the Veeam B&R...the .ps1 script and the .bat file are in the same folder.


EDIT...I thought I could only use batch files but I notice the dropdown on what type of script you can have and there was a PowerShell one so I've selected my PowerShell script direct and see if that runs tonight. So does that mean you cannot reference other files?
homerjnick
Expert
 
Posts: 203
Liked: 35 times
Joined: Mon Feb 20, 2012 4:13 pm
Full Name: Nick Mahlitz

Re: Script After Replication Job Not Running

Veeam Logoby v.Eremin » Thu Oct 20, 2016 12:16 pm

If you execute the very same script under Veeam service account, will it work as expected or not? Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Script After Replication Job Not Running

Veeam Logoby homerjnick » Thu Oct 20, 2016 1:21 pm

The Veeam Service Account is the same account that I use to RDP to the B&R server and running the script under that is fine..but indeed it must be some sort of permission thing.

I've eliminated the batch file and just execute the PowerShell script after the job so I'll see what happens tonight.
homerjnick
Expert
 
Posts: 203
Liked: 35 times
Joined: Mon Feb 20, 2012 4:13 pm
Full Name: Nick Mahlitz

Re: Script After Replication Job Not Running

Veeam Logoby foggy » Thu Oct 20, 2016 2:29 pm

Could it be the non-interactive mode the service uses to perform its tasks? While when you're logged in under the same account, you're working in interactive mode.
foggy
Veeam Software
 
Posts: 15087
Liked: 1110 times
Joined: Mon Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson

Re: Script After Replication Job Not Running

Veeam Logoby v.Eremin » Thu Oct 20, 2016 2:30 pm

Only batch and executables are supported as a pre/post-job activities. The option you're talking about just allows you to limit visible scope to files of particular type.

So, if you want to avoid usage of batch file, try the following construction as a post-job activity:

Code: Select all
Powershell.exe -File "Path to your script"


Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Script After Replication Job Not Running

Veeam Logoby homerjnick » Thu Oct 20, 2016 3:24 pm

Ok...thanks for that...I've set that for tonight.
homerjnick
Expert
 
Posts: 203
Liked: 35 times
Joined: Mon Feb 20, 2012 4:13 pm
Full Name: Nick Mahlitz

Re: Script After Replication Job Not Running

Veeam Logoby homerjnick » Mon Oct 24, 2016 1:23 pm

foggy wrote:Could it be the non-interactive mode the service uses to perform its tasks? While when you're logged in under the same account, you're working in interactive mode.


This could be the answer as it is still not running.

I see in the logs:

Log has been started by 'SPP-VEEAM\localesxadmin' user (Non-interactive)

If that is the case then the script will not run under that...it runs fine logged in to my Veeam B&R Server as 'SPP-VEEAM\localesxadmin' but that will be in interactive mode.

I'll see if I can reference to run the script under different credentials.
homerjnick
Expert
 
Posts: 203
Liked: 35 times
Joined: Mon Feb 20, 2012 4:13 pm
Full Name: Nick Mahlitz

Re: Script After Replication Job Not Running

Veeam Logoby homerjnick » Mon Oct 24, 2016 2:27 pm 1 person likes this post

Changing the credentials used by referencing a RUNAS has done the trick...
homerjnick
Expert
 
Posts: 203
Liked: 35 times
Joined: Mon Feb 20, 2012 4:13 pm
Full Name: Nick Mahlitz


Return to VMware vSphere



Who is online

Users browsing this forum: No registered users and 14 guests