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.

Thanks,
Jason
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
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.
Answered 12/31/2009 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
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.
Answered 12/31/2009 by: tcasey
Senior Yellow Belt

Please log in to comment
0
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.
Answered 12/31/2009 by: jg1000c
Orange Belt

Please log in to comment
0
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?
Answered 01/02/2012 by: zookdj
Second Degree Blue Belt

Please log in to comment
0
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
Answered 01/02/2012 by: zookdj
Second Degree Blue Belt

Please log in to comment
1
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"
Answered 01/03/2012 by: dchristian
Red Belt

  • 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.
Please log in to comment
Answer this question or Comment on this question for clarity