/build/static/layout/Breadcrumb_cap_w.png

KACE SMA Scripting Quick Reference

KACE SMA Scripting Quick Reference

 

Configure

Oeu2EAAAAASUVORK5CYII=

Most fields are self-explanatory. There are 3 Types of scripts to choose from.

·         Offline KScripts will execute at a specific time based on each client's clock, and can even execute when the device is not connected to the K1000, such as Device Boot Up and User Login.

·         Online KScripts are built just like Offline KScripts, but will execute at a specific time based on the server clock instead of the client clock. Only devices that are connected at the designated time will be targeted for execution.

·         Online Shell Scripts will execute at a specific time based on the server clock. Instead of building the script through the task wizard, shell scripts are simple text commands specific to the operating system. Batch files are supported on Windows, along with all manner of shell script formats supported by the specific operating system of the targeted devices.

Deploy

rueca4joffgAAAAASUVORK5CYII=

Devices and Labels items are the same as in Managed Installs and Patching. Specifying an Operating System or Operating System Family will unlock options that are OS specific.

Windows Run As

+P3fuZ5PGe0FOAAAAAElFTkSuQmCC

This option is only available if a Windows OS is selected in the previous section. The KACE SMA agent runs everything as the Local System account, except when these options are used.

·         Local System: Run the Online Shell Script and KScripts as LOCAL SYSTEM account.

·         Logged-in user: Run the Online Shell Script and KScripts as the user logged in to physical console.

·         All logged-in users: Run the Online Shell Script and KScripts as all users currently logged into the system. This includes users logged in physically to the device or remotely. The script will run once for each user in that user's context.

·         Credentials: Run the Online Shell Script and KScripts in the context of specified credentials. The K1000 Agent will try to login to all the selected devices using the specified credentials and execute the script in context of the specified user. Credentials can be stored in the K1000 by going to Settings › Credentials › Credentials Management.


 

User Notify

This works the same as the Notify section in Patching.

Schedule

f8B8ibtWnpBdfEAAAAASUVORK5CYII=

The Schedule works the same as in Patching. However, the two checkboxes are important to keep in mind when running scrips while End Users may not be present.

·         Allow run without a logged-in user

·         Run on next connection if offline

Dependencies  

92GOPLViwYMSIEWeccYZNqksiqAT0E4CAiD+FiJe9ZwAAAEQuukqg4ETzmUDqbzLYQMNgbxsAAACRoxJAnOwYAgAAIHJUAoiTHUMAAABEjkoAcbJjCAAAgMhRCSBOdgwBAAAQsS+++P+Y81UKtxbDgwAAAABJRU5ErkJggg==

·         The Edit XML button is for advanced users, and out of scope for this document.

·         Dependencies are any additional files that you want to include as part of the script (BAT, EXE, ZIP, etc.…).

o   Prior to script execution, all dependencies will be downloaded to the endpoint.

o   The downloaded dependencies can be found in C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\<Script ID#>


 

Tasks

Task Example

WeZn8a2IRJAAAAABJRU5ErkJggg==

This is the task for the Reboot kscript shown earlier in the Doc

·         This task will attempt to run once.

·         If the task fails it will not continue to any other task, and the script will end.

·         The On Success step will always run because the Verify step was left blank

·         The On Success Step is executing two actions.

o   The first action Launces a program, by specifying the path to the file, and parameters.

BiKoJGmOicAAAAAElFTkSuQmCC

o   The second action creates a log entry which will be visible in the K1000 log files

h9TQXYcctK8cQAAAABJRU5ErkJggg==

·         No other actions will be takes as part of this task, or script.

Task Flow

Tasks are the bulk of a Kscript. Task Follow a lose If Then Else logic.

1)      Verify Some Criteria.
If left blank the task will automatically go to On success
Can be set to ‘Always Fail’ so the task will automatically go to Remediation

2)      Verify comes back as Ture or False.

a    Verify comes back true: go to On success.
Then task will end after this Step

b)      Verify comes back False: Go to Remediation

3)      Remediation comes back as Success or Failure

a)       Remediation comes back Successful: Go to On Remediation Success
Then task will end after this Step

b)      Remediation comes back Failure: Go to On Remediation Failure
Then task will end after this Step

 

qE2obWCZ6BcY6BfmidpkmHttzjbwAgAAAH0g8AIAACBpBF4AAAAkjcALAACApBF4AQAAkDQCLwAAAJJG4AUAAEDSCLwAAABIGoEXAAAASSPwAgAAIGkEXgAAACSNwAsAAICkEXgBAACQsCz7H6jhNF1gBTSDAAAAAElFTkSuQmCC

Blue Question Mark?

 

n+HySH40Dq2uAAAAABJRU5ErkJggg==

The Blue question mark, to the right of the task header, provides a reference list of variables available to the following task steps.

2Q==

For Example: the file ‘example.bat’ was uploaded as a dependency. To run this file in the On Success step, choses Launch a program as for the action, and specify the path to the program, the file name, and any parameters.


Comments

  • A friend shared this with me. Figured I'd pass it along and hope it helps someone else down the road - jonniipalos 5 years ago
    • This was provided some much needed clarity. Thank you for sharing! - egas 3 years ago
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