Highlighted

Run powershell after job completion

I have been reading the different documents concerning executing a Powershell script after job completion.

In the windows "Pre/Post Commands", I have entered:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionPolicy bypass -noprofile -Noninteractive -file C:\Scripts\BEincend.ps1

But it never gets executed.

Is the command incorrect?

Running the script from command line works great

Regards, Lars.

Tags (2)
5 Replies
Highlighted

Re: Run powershell after job completion

What are the reasons​ that you are coding the environmental ​variables in your command?

Have you tried setting the PowerShell environment globally for the server and only executing the script in the command?

 

Highlighted

Re: Run powershell after job completion

I copy pasted the variables from a guy posting that it worked for him. I also tried running a cmd-file instead, but backup job ends with:

"...
Beskrivelse:
Backup Exec Alert: Job Failed
(Server: "DKDMBCK01") (Job: "FS01 Backup 00002-Incremental") FS01 Backup 00002-Incremental -- The job failed with the following error: The pre/post command has returned an error.

For more information, click the following link:
https://telemetry.community.veritas.com/entt?product=BE&module=eng-event&error=V-379-34113&build=ret...
Hændelses-Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Backup Exec" />
<EventID Qualifiers="8192">34113</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2017-05-18T20:42:22.115423000Z" />
<EventRecordID>9956</EventRecordID>
<Channel>Application</Channel>
..."

But it does not tell which error occoured.

But what would be the correct approach to run a powershell script from a backup exec job?

Regards, Lars.

Highlighted

Re: Run powershell after job completion

Might be woth putting the power shell command in a .CMD or .BAT file and calling that instead

 

Within the batch/command file, you could then precede the powershell command with some echo out to text file commands so that you can easily see if Backup Exec is sucessful at calling the script and then fails with the powershell part or if BE itself has a problem calling the external command / script in the first place.

Re: Run powershell after job completion

I actually did try to pass it through a cmd (as I wrote), but it still fails...

Good idea... I have now piped it to a txt-file... well see if it the nights job tells me anything.

Regards, Lars.

Highlighted

Re: Run powershell after job completion

Apparently I had to tick the "run on this server".

Having another problem now... starting a new thread.

 

Regards, Lars.