Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

bemcmd.exe returns -1 when run through batch file

Created: 16 Jul 2013 • Updated: 18 Jul 2013 | 12 comments
This issue has been solved. See solution.

On Windows Server 2003, I've a batch file that is configured as post backup event in Backup Exec 2010 R3. The batch file contains "bemcmd.exe" -o21 -v -e -j"myjob" -c"myhost" command. When backup job is run I get the following error. BE console says job successful.

-----------------

Backup Exec Command Line Applet version 13.0.5204.
Copyright (c) 2011 Symantec Corporation.  All rights reserved.

Connecting to media server '\\myhost'...
Connected.
Success.
Getting list of jobs...
Success.
ERROR: Specified object not found.
Disconnecting from server...
Disconnected.
RETURN VALUE: -1

-----------------

However the same batch file runs fine when executed at DOS command prompt and I get the job completed status.

Can someone get me out of this problem?

Thanks/Hem

Operating Systems:

Comments 12 CommentsJump to latest comment

pkh's picture

During the time when the post-command is executed, the job has not completed.  Hence you are not able to get the job completion status.

HemC's picture

Thanks for the reply. But as you see in my post, Backup Exec says no "ERROR: Specified object not found.". I'm wondering why BE is unable to find job itself when run through batch file.

pkh's picture

You are only assuming it is the job object that is not found.  It could be the job status object that is not found.

HemC's picture

Thanks for tyring to get me out of this problem.

I tried with 5 min delay and it is the same status. BE supposed to trigger the my batch file as a psot backup event. My understanding is If BE triggers the batch file means, backup job completed, since it is a post backup command. Is my inderstanding wrong?

pkh's picture

Although the backup/verification phase is over, the job has still not completed because there is the option to cancel the command if it is not completed after a certain time period.

HemC's picture

Since runnig the batch file at command prompts works fine, I'm wondering if BE got anyting do with the user account that its services run with.

BE Server, Job Engine, Device and Media Service, Agent Browser services run with the logged in user credetials. In my setup, it is a domin user, part of system Administrators group.

BE Error Recording and Remote Agent for Windows systems services run with "local system" account.

BE management service does not run on my machine.

 

pkh's picture

You might want to look at upgrading to BE 2012 which has BEMCLI.  It is very easy to get the job status and history with BEMCLI.

HemC's picture

Unfortunately, I cannot upgrade easily. we've got a lot of dependecies.

Colin Weaver's picture

It might also be the security context is different

When you run it in a command prompt you are using the context of the user logged into the console of the server. if you run it as a batch file I assume you are triggering it either as a pre- post command on the backup job, or as a schueld task and teh security c ontext will then either be teh backup Exec servcies or whatever level the item that schedule the start of the batch file sits at.

If not done already disable things like user access control.

Also make sure that the user account has things like logon as a batch job, run as a services etc enabled and not blocked by group policy

 

pkh's picture

This assumption on security can be easily checked by logon on as the BESA and then running the script in a command prompt.

HemC's picture

I verified and it seems to be fine. If the user does not have this permission batch file itself would not haven been triggered. Here, the batch file is getting triggered by BE and  "bemcmd.exe" -o21 -v -e -j"myjob" -c"myhost"" command in batch file is executed. The only ptoblem is BE does not find the job.

HemC's picture

I finally got it solved differently. Now BE post job command batch script creates a task in Windows scheduler and the task in scheuler triggers a batch file that in turn issues ""bemcmd.exe" -o21 -v -e -j"myjob" -c"myhost"". I get the job status this way.

SOLUTION