/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


KACE - Script to run batch file always failing

11/15/2019 320 views

I've put together a Script in KACE to run a pretty simple batch file which adds a serial number to Adobe Acrobat. We've been manually running the script so I know the script itself works. It requires admin privileges to run so I set Windows Run As to "Credentials" with an admin account (I've used this admin account setting before successfully as well). However, every time I run the script on machines KACE shows it as failing. If I go to a machine where it failed, (logged in as Admin), and navigate to C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\142\ and run the script created by KACE (in this case: kace9952.bat) it works correctly.  So why is it failing when KACE pushes/runs it?


The script in KACE is just this:


Dependencies: 
adobe_prtk.exe
prov.xml
SerializeAcrobat.bat 


 Verify:

Verify that the directory “C:\Program Files (x86)\Adobe\Acrobat DC” exists.


On Success:

Run A Batch File

Batch file:     SerializeAcrobat.bat (so all it does is call the batch file which is uploaded as a dependency - I have tried it with %cd%\SerializeAcrobat.bat as well, and I have also tried to put the contents of SerializeAcrobat.bat directly into this field and it still fails)



This is what the Run As log shows for each failed machine:

Output Log

Running with credntials provided: domain [dcd] user [AdminDRB]

Creating process returned non-zero: C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\142\kace9952.bat : (0) The operation completed successfully.

Error Code: 0

Status Code: 1

Activity Log

verify - on_verify_success

verify - on_verify_failure

verify - launch_program

Launching program: 'C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\142\kace9952.bat' '' wait='true'

Debug Log

Running kbot: runkbot 142 1573853411r1

KBotScript::LogScriptInfo - Start

id=142 name=Acrobat DC - Reserialize (test group) version=1573853411r1 type=policy

execute disconnected=false logged_off=true

execute events

KBotScript::LogScriptInfo - Finish

KBotScript::LogScriptInfo - Start

id=142 name=Acrobat DC - Reserialize (test group) version=1573853411r1 type=policy

execute disconnected=false logged_off=true

execute events

KBotScript::LogScriptInfo - Finish

KBotScriptManager::CleanupDependencies - clean up dependencies in kbot directory C:\ProgramData\Quest\KACE\kbots_cache\\packages\kbots\142\

runkbot    ----- launching [path='C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\142' program='kace9952.bat' parms='' wait='true'] -----

0 Comments   [ + ] Show comments

Comments


All Answers

1

Did you try to run the .bat manually on one machine? If you cannot run it manually it will not run automatically. Makes sense?

Answered 11/16/2019 by: jcorrale
White Belt

1

Why are you calling the batch within a batch?


Instead of 'Run a Batch File....' you can use 'Launch a program....'.

If the file is in the repository, you can get it from the matching directory with the variable $(KACE_DEPENDENCY_DIR).

Example as a screenshot.

mZ5qnXQAAAABJRU5ErkJggg==

Answered 11/17/2019 by: Gerhart
Purple Belt

  • Oh, good call. I set it up this way and now it's showing as successful in KACE. Thanks for the tip.