/build/static/layout/Breadcrumb_cap_w.png

How to Run a Powershell Script from K1000

There is probably a better "best practices" that you should do, but here is the down and dirty way to just run a powershell script through the "Script" feature in KACE. 

I have also exported my xml file that you could import and modify as needed. 

Manually create a new script with these settings.
Create New Script. 
Upload the .ps1 file you want to run and add a task with these settings. Again this is down and dirty. You should probably do a verify task and run this in an "On Success" or somewhere else that would help you in debugging when not running as planned.
fZ84zO.png


Here is an export of the .xml I have. You will have to upload your .ps1 (that you are trying to run) and change the name in the task, but maybe this will help. 
Just got Scripts->Choose Action->Import
Paste this xml in the wysiwyg
<?xml version="1.0" encoding="utf-8" ?>
<kbots xmlns="http://kace.com/Kbots.xsd">
<kbot>
<config name="Set LSE Variables" type="policy" id="122" version="1513263821" description="Set variables to be used when in scripting. Put description below in the notes for each one. ">
  <dependencies>
    <dependency name="/orgs/3/kbots/122/Sample.ps1" checksum="4f5c378ccea4e98597951bd3d4f7c6b5"  />
  </dependencies>
  <execute disconnected="false" logged_off="false">
  </execute>
</config>
<compliance>
  <verify on_failure="break" attempts="1">
    <launch_program path="$(KACE_SYS_DIR)\WindowsPowerShell\v1.0" program="powershell.exe" wait="true" parms="-executionpolicy remotesigned -File $(KACE_DEPENDENCY_DIR)\Sample.ps1" />
    <on_verify_success>
    </on_verify_success>
    <on_verify_failure>
      <on_remediation_success>
      </on_remediation_success>
      <on_remediation_failure>
      </on_remediation_failure>
    </on_verify_failure>
  </verify>
</compliance>
</kbot>
</kbots>
Hope this helps somebody.

Comments

This post is locked
 
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