截屏视频帮助

bemcmd.exe returns -1 when run through batch file

创建时间: 16 7 月 2013 • Updated: 18 7 月 2013 | 12 条评论
此问题已解决。 请查看解决方案。

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

评论 条评论跳转至最新评论

pkh 的图片

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 的图片

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 的图片

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 的图片

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 的图片

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 的图片

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 的图片

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 的图片

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

Colin Weaver 的图片

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 的图片

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

HemC 的图片

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 的图片

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.

解决方案