cancel
Showing results for 
Search instead for 
Did you mean: 

Can anything other than a .bat file be run as a pre or post command?

Scott_Federoff
Level 2
Does anyone know if you can run anything other than a bat file as a pre or post command? I have tried to run an exe and a vbs file but did not have any luck. I can not seem to find much documentation on this topic at all.

Thanks.
Regards,
Scott
6 REPLIES 6

perry_baker
Level 6
Employee Accredited
You can pretty much run any command that does not need to interact with the user.

The easiest way to demonstrate is to simply input a basic net stop test_service command in the pre command, run a small test and see that the service is stopped.

You can also review page 365 in the admin guide for complete information.

Ken_Putnam
Level 6
Couple things to remember -

When the Pre and Post jobs run, there is no environment and hence no PATH defined. Try putting absolute paths in your PRE/POST job definition

When the Pre/Post job runs, it runs under the context of the BackupExec service account. Try logging on as the Service Account and see if you can run it/them from the command prompt.

if the Pre/Post jobs do require a path (that is they depend on other EXEs or DLLs that are not in the same directory, create a CMD file that contains a PATH command as well as the EXE.Message was edited by:
Ken Putnam

Scott_Federoff
Level 2
Thanks for the pointers. I have logged into the system as the service account and tried to execute my simple vbscript outside of backup exec. It worked just fine. I also created a test job in backup exec to run the net stop command. That was successful. I then tried my vbscript, and it failed with the following error:

Starting Pre Job Command < Y:\OS_backups\scripts\pre_test.vbs >
-
Error: Could not start Pre Job Command < Y:\OS_backups\scripts\pre_test.vbs >. Error (193): Y:\OS_backups\scripts\pre_test.vbs is not a valid Win32 application.



Error: Job vb script test Canceled.


I reviewed the link listed below which was provided in the job log. The service was set up correctly.
http://seer.support.veritas.com/docs/262355.htm




Here is the test vbscript that I am trying to execute:

Dim EVENT_STATUS

Set objfso = CreateObject("Scripting.FileSystemObject")
Set objShell = Wscript.CreateObject("Wscript.Shell")

On Error Resume Next
If objfso.FileExists("C:\Temp\pending.txt") = True Then
EVENT_STATUS = 1
objShell.LogEvent EVENT_STATUS, _
"Full tape backup process not complete."
err.number = 1000
end if

Tim_Nilimaa
Level 4
try "wscript.exe "

Martin_Schenk
Level 2
Hello,

I have a similar problem; I want to execute a .vbs script after a BackupExec Job has finished. I tried "wscript.exe ", "cscript.exe ", also with the switch //B; none of these worked. I see in the process list that there is a wscript.exe (or cscript.exe respectively) but nothing happens; if it wasn't for the time limit i set up, the job would never have finished. This points to a user interaction that is not displayed and thus waits forever; but my script only copies some files and writes a log - no user interaction; and with the //B parameter, there shouldn't appear any error messages as well.
Then I tried running a .bat file with "echo test > c:\test.txt"; the file was not created but the job completed successfully.
Is there a limitation to the post-job-command that prevents file access? The topic is hardly covered in the manual.

Regards,
Martin

AverageUser
Not applicable
I had the same problem. Here is the solution
 
c:\windows\system32\cscript.exe c:\path\to\your\file.vbs

(alternately c:\winnt\<theRestTheSame> if you have an older version)