K1000 - How do I launch a bat file by using the scripting tab?
Hi,
I'm trying to launch a .bat file that is located on a network share. This bat file contains info to launch an installer that's also located on the network share. Using Scripting, how do I perform this task? I'm having no luck running via Scripting. In this script I have set it to Allow Run While logged Off, it's running as an machine admin, not system account.
I have tested the bat file manually and it works. When I perform a Run Now and glance at the logs I get this error:
I'm sure I'm doing something wrong, but don't know what. Please help. Thanks!
Answers (4)
Sorry for the new answer. I can't post pics in comments. Make sure Windows is selected as the OS. If not you will not get this option.
Comments:
-
The bad thing about using the verify to run the bat is that it will always run. I would suggest checking for a file or registry under verify. Then if that file does not exist Remediation will call the bat file. This way it only runs if it needs it. - dugullett 12 years ago
-
Thanks!! This kind of worked for me. It works great when a user is logged on, but doesn't work when a user is not logged on. I enabled debug on that machine and the debug log didn't help me much other than it looks like it should have worked:
Debug Log
Kbot Config Info - Start
id=53 name=adobe test version=1348003026 type=policy
execute disconnected=false logged_off=true
execute events
Kbot Config Info - Finish
runkbot ----- launching [path='C:\ProgramData\Dell\KACE\\kbots_cache\packages\kbots\53' program='kace5146.bat' parms='' wait='false'] -----
runkbot ----- completed [exitCode=0] -----
Have you been able to get bat files to run this way when no user is logged in? We are running win7 x64. I'm using the run as option and selecting a user that has admin rights to the desktop and has rights to access the unc share for the installation. Thanks! - jpastrano 12 years ago
On my K1000, there's an example script named "Uninstall Msiexec Template" which has the "Run a batch file" option in the Remediation section. I have copied this script countless times so I could do as jknox advised - include a Verify step (even if it always fails). Hopefully you have this example script and can use it as a template as I did (not sure if it's only on older KBOXes or not...).
Here's a screen just to show you exactly what I mean:
I typically have these set to run as Online KScripts, either with Run As Local System *or* Run As User logged in to console, depending on the target.
Hope that helps!
John