KACE SMA Scripting Quick Reference
Configure
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
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
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
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
· 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
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.
o The second action creates a log entry which will be visible in the K1000 log files
· 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
Blue Question Mark?
The Blue question mark, to the right of the task header, provides a reference list of variables available to the following task steps.
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