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
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?
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:
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:
<Provider Name="Backup Exec" />
<TimeCreated SystemTime="2017-05-18T20:42:22.115423000Z" />
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?
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.