diff --git a/lib/mcollective/util/tasks_support.rb b/lib/mcollective/util/tasks_support.rb index 1538abdd..546f980c 100644 --- a/lib/mcollective/util/tasks_support.rb +++ b/lib/mcollective/util/tasks_support.rb @@ -167,8 +167,8 @@ def task_command(spooldir, task) file_name = File.join(spooldir, "files", task_module(task["task"]), "tasks", file_spec["filename"]) command = platform_specific_command(file_name) - - command.unshift(ps_shim_path) if task_input_method(task) == "powershell" + # the ps_shim_path should be before the actual powershell task script instead of the front. + command.insert(-2, ps_shim_path) if task_input_method(task) == "powershell" command end