I have a VBScript I want to push out and execute on machines. I have targeted one test windows 7 machine. I am using Online KScript and added the .vbs file I want to execute as a dependency. I set the directory = $(KACE_SYS_DIR) and set the Parameters = "$(KACE_DEPENDENCY_DIR)\PurgeTempFiles.vbs"

the output log shows this.

Running as: SYSTEM
Creating process returned non-zero: C:\Windows\System32\PurgeTempFiles.vbs "C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\56\PurgeTempFiles.vbs": (2) The system cannot find the file specified.
Error Code: 2
Status Code: 0

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answer Chosen by the Author

0
The directory, file, and parameters fields must be configured correctly to successfully launch the VBS. If you're trying to call a dependency directly, you'd set directory to $(KACE_DEPENDENCY_DIR), set the file to PurgeTempFiles.vbs and you wouldn't need any parameters unless the VBS requires parameters. You may have to call the VBS file via something like cscript to get it to run properly. In that case, you'd set file to cscript.exe, and set parameters to $(KACE_DEPENDENCY_DIR)\PurgeTempFile.vbs.

You've got kind of a mixture of both of the methods I explained, so try modifying to suit one of them and you should have success. The script that you've described above is calling a directory with no file and then passing parameters - which I wouldn't expect to do succeed. From the log, it looks like it tried to run the VBS from the system directory - which isn't going to work unless you put that script there by some other means first.

If you require further assistance, please feel free to contact Dell KACE Support.
Answered 06/23/2015 by: airwolf
Tenth Degree Black Belt

  • I am now getting this error. 193.

    Output Log
    Running as: SYSTEM
    Creating process returned non-zero: C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\56\PurgeTempFiles.vbs : (193)
    Error Code: 193
    Status Code: 0

    Activity Log
    Launching program: 'C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\56\PurgeTempFiles.vbs' '' wait='true'
    • 193 is a VBS error. You'll want to call cscript.exe and pass it the full path of the vbs as a parameter. This is the 2nd scenario I explained above.
      • Ok using cscript.exe. getting invalid directory.

        Output Log
        Running as: SYSTEM
        Creating process returned non-zero: C:\Windows\System32\cscript.exe C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\56\PurgeTempFiles.vbs: (267) The directory name is invalid.
        Error Code: 267
        Status Code: 0Activity Log
        Launching program: ' C:\Windows\System32\cscript.exe' 'C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\56\PurgeTempFiles.vbs' wait='true'


        Thanks for your help!
      • CScript.exe is actually in C:\Windows\Command, usually. You should be able to just call cscript.exe without using a directory, but if you do fill out the directory field it must be correct.
      • I am specifying this for directory $(KACE_SYS_DIR) and cscript.exe does exist in C:\Windows\System32\
      • Try without specifying a path for cscript.exe. You're at the mercy of the command line now. You may have to tinker until you find a command that works outside the K1 via command line, and then copy that method into the configuration of the KScript.
      • Success, taking out the directory worked! Whew!
      • Hooray!
Please log in to comment

Answers

0
You should look into the potential issues caused by Kace being a 32 Bit application on 64 bit machines. Kace will run cscript as 32 bit by default. This could easily break your script or cause unwanted behavior. 

On 64 bit machines you would want to use C:\windows\sysnative\ instead of $(KACE_SYS_DIR). On a 64 bit machine $(KACE_SYS_DIR) actually is launching cscript from the 32 bit directory C:\windows\syswow64\

This starts to become a very big headache when trying to make custom inventory rules or other sorts of scripts. Instead of using the launch a program, it might better to write a wrapper script or select run a batch file and do something like this:


if defined ProgramFiles(x86) (C:\windows\Sysnative\cscript.exe script.vbs) else (cscript.exe script.vbs)


There may not be a problem caused in that specific script, but I find that it is better to get in the habit of running under the proper architecture.

Answered 06/29/2015 by: gerane
Senior White Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share