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.
Thanks,
Jason
Thanks,
Jason
0 Comments
[ + ] Show comments
Answers (6)
Please log in to answer
Posted by:
dchristian
12 years ago
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 :) ).
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"
Comments:
-
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 11 years ago
Posted by:
airwolf
14 years ago
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
14 years ago
Posted by:
jg1000c
14 years ago
Posted by:
zookdj
12 years ago
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?
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
12 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.