Environment
Novell ZENworks 10 Configuration Management
Situation
In a bundle with script action to run batch file, use of:
find "somefile" *.*
may crash ZENworksWindowsService .
ERROR: "Unhandled exception in find.exe "
Resolution
Check errorlevel codes within the batch file to catch error (Example 1) or avoid passing the errorlevel to ZENworks agent (Example 2):
Example 1:
@echo off
find "somefile" *.*
if errorlevel==1 goto notfound
echo "Search string found"
goto end
:notfound
echo "Search string not found"
:end
find "somefile" *.*
if errorlevel==1 goto notfound
echo "Search string found"
goto end
:notfound
echo "Search string not found"
:end
Example 2:
find "some" *.*
goto end
end:
goto end
end:
Additional Information
The problem is specific to find.exe.
find.exe returns an error level 0 if the string is found and returns 1 if the string is not found.
The error level from find and process exit codes are different.
When find.exe is used in the batch file, the exit code of the process start is always 1 and the bundle fails, although the string is found. The ZENworks agent checks for exit code value to be 0 for the bundle to be considered successfully run.