running powershell script from kbox

Is there a trick to running a powershell script from kbox scripting module? I can get the script to launch powershell.exe, but it never completes. It just shows the powershell.exe process running. I create a shell script and call the powershell script from the batch file that gets created.


0 Comments   [ + ] Show comments

Answers (6)

Posted by: dchristian 11 years ago
Red Belt
I usually add my powershell scripts as a shell script.

Upload the script as a dependency.

Here's the command line (it'll bypass your scripting policy :) ).
powershell.exe -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "script.ps1"

  • Does the "script.ps1" need to have a path to work. I just tried this using an online shell script and it came back with error 193. - GeekSoldier 9 years ago
Posted by: airwolf 13 years ago
Red Belt
I'm not quite sure I understand how you've got things setup. You're using the scripting module to create a local powershell script that you then try to launch using the scripting module? The easiest way I can think of to setup a powershell script would be to create the PS script and add it as a dependency file to the KBOX script.
Posted by: tcasey 13 years ago
Senior Yellow Belt
Have you verified that the execution policy of powershell on the target machine is set to "RemoteSigned" or "Unrestricted"? By default powershell will not execute scripts.
Posted by: jg1000c 13 years ago
Orange Belt
Yes, it's unrestricted, however I'm not sure if the script actually does execute, it does cause powershell.exe to execute. I decided to just schedule it from a windows box and it works fine.
Posted by: zookdj 11 years ago
Second Degree Blue Belt
I'm trying to get this setup too. I have the PS1 file as a dependency, and the single command in the script was setup to call $(KACE_SYS_DIR)\WindowsPowerShell\v1.0\powershell.exe, parameters: -file $(KACE_DEPENDENCY_DIR)\createDailyChecklist.ps1

The error message that is returned when the kscript is run:
Running as: SYSTEM Error creating process: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -file C:\Documents and Settings\All Users\Dell\KACE\\kbots_cache\packages\kbots\277\createDailyChecklist.ps1: (-196608) I was able to run the script using the local system account by following the KACE article on testing scripts under the local systems credentials.

I think this could be a bug in the KBox where it doesn't send a valid path.

Anyone have any suggestions on how to work around this?
Posted by: zookdj 11 years ago
Second Degree Blue Belt
Found the problem with my script setup. I added quotes around the script path argument, and that fixed it.

See http://itninja.com/question/performance-monitoring155
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ