Configuring Action Menu Items
Jamf Connect Verify has an extensible Actions menu that allows administrators to create custom interactive menu items that will appear in the Jamf Connect Verify menu. These menu items may include the following:
-
Links–You can link to webpages and apps.
-
Scripts–You can run scripts in the background on custom intervals, which can hide or show a menu item, change the text, and add menu actions based on the script's results or other built-in tests.
Action menu items are added with an additional configuration profile written to the following domain:
com.jamf.connect.actions
Actions are listed as an array of dictionaries with each dictionary comprising one action. The following configuration profile is an example of action menu items:
<plist version="1.0">
<dict>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadDisplayName</key>
<string>Jamf Connect Actions</string>
<key>PayloadDescription</key>
<string>Jamf Connect Actions</string>
<key>PayloadOrganization</key>
<string>Jamf</string>
<key>PayloadUUID</key>
<string>27870006-41CB-4694-A6AD-709073670851</string>
<key>PayloadEnabled</key>
<true/>
<key>PayloadScope</key>
<string>System</string>
<key>PayloadRemovalDisallowed</key>
<true/>
<key>PayloadIdentifier</key>
<string>com.jamf.connect.actions</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadType</key>
<string>com.jamf.connect.actions</string>
<key>PayloadDisplayName</key>
<string>Jamf Connect Actions</string>
<key>PayloadDescription</key>
<string>Jamf Connect Actions Settings</string>
<key>PayloadOrganization</key>
<string>Jamf</string>
<key>PayloadUUID</key>
<string>98B42AF5-4040-47D1-9F6F-A0E1D7FBFC26</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadIdentifier</key>
<string>com.jamf.connect.actions</string>
<key>Version</key>
<integer>1</integer>
<key>Actions</key>
<array>
<dict>
<key>Title</key>
<dict>
<key>Command</key>
<string>path</string>
<key>CommandOptions</key>
<string>/usr/sbin/ipconfig getifaddr en0</string>
</dict>
<key>ToolTip</key>
<string>Primary IP Address</string>
<key>Name</key>
<string>en0</string>
</dict>
<dict>
<key>Name</key>
<string>Hostname</string>
<key>Title</key>
<dict>
<key>Command</key>
<string>path</string>
<key>CommandOptions</key>
<string>/bin/hostname</string>
</dict>
</dict>
<dict>
<key>Name</key>
<string>separator</string>
</dict>
<dict>
<key>Action</key>
<array>
<dict>
<key>Command</key>
<string>url</string>
<key>CommandOptions</key>
<string>https://www.jamf.com</string>
</dict>
</array>
<key>Name</key>
<string>Open jamf.com in your browser</string>
</dict>
<dict>
<key>Action</key>
<array>
<dict>
<key>Command</key>
<string>app</string>
<key>CommandOptions</key>
<string>/Applications/Calculator.app</string>
</dict>
</array>
<key>Name</key>
<string>Open the macOS Calculator</string>
</dict>
</array>
</dict>
</array>
</dict>
</plist>
Global Preferences
Within the com.jamf.connect.actions domain, the following global preference keys can determine the behavior of the menu.
Attribute |
Description |
Type |
Required |
Version |
The numeric version of the preference file. Currently, only "1" is supported. |
Integer |
Yes |
MenuIcon |
Determines if the Action menu will display a status icon (green, yellow, or red) Note: MenuIcon will display a green, yellow, or red icon next to the main Action menu based upon the "worst" of the visible items in the submenu. For example, if you have any visible submenu actions that have a red icon next to them, the main menu will have a red icon. If any visible submenu actions are yellow and none are red, the main menu item will have a yellow icon. |
Boolean |
No |
MenuText |
Determines if the text of the main action menu will be the result of the command. Note: MenuText requires a command to return a result of `<<menu>>` followed by your menu. The last command to return a result containing `<<menu>>` will determine what the menu title is. |
Boolean |
No |
Action Content
An Action is comprised of meta data and four phases. Each phase has a collection of commands in them. These commands have the command itself and then a CommandOptions that can modify the command. Commands can execute external scripts or use the built-in functions included with Actions. The only required part of the Action is the name of the action, all the other parts are optional.
Attribute |
Description |
Type |
Required |
Name |
Plaintext of name of the action. |
String |
Yes |
Title |
Determines the name of the menu item. Note: If unspecified, the Name will be used as the title. |
Dictionary |
No |
Show |
Determines if the item is displayed in the menu |
Array |
No |
Action |
Contains the action. Note: An action named "separator" will become a separator bar in the menu. |
Array |
No |
Post |
Determines what happens if the action commands run. |
Array |
No |
GUID |
The unique ID for the action |
String |
No |
Connected |
Determines if the action set should only be run when connected to the AD domain |
Boolean |
No |
Timer |
Length in minutes between firing the action |
Integer |
No
|
ToolTip |
The text displayed when hovering over a menu item. |
String |
No |
Commands
Jamf Connect Verify has built-in commands. Since one command is to execute a script, you can quickly make unique commands. Consider the following about commands:
-
Each command has a CommandOptions value that determines what the command does.
-
All options are strings.
-
All commands can return results.
-
Results do not persist between command sets.
-
CommandOptions support the standard Jamf Connect variable swaps such as `<<domain>>`, `<<user>>`, and `<<email>>`.
-
Commands are case sensitive.
Command |
Function |
Option |
path |
Execute a binary at a specific file path |
The path to execute |
app |
Launch an app at a specific file path |
The path of the app |
url |
Launch a URL in the user's default browser |
The URL to launch |
ping |
Ping a host. |
The host to ping |
adgroup |
Determine if the current user is a member of an AD group |
The group to test |
alert |
Display a modal dialog to the user Note: If the command options are blank or are either "true" or "false", no alert will display. You can use this to only show errors. |
Alert text |
notify |
Display a notification in the notification center Note: If the command options are blank or are either "true" or "false", no notification will display. You can use this to only show errors. |
Notification text |
false |
A command that always returns false |
Text |
true |
A command that always returns true |
Text |
True and False
The following should be considered when using true and false commands:
-
A result of "false" is used by the Show action to prevent the menu item from being shown.
-
The result of any command can be passed on to the next. Using `<<result>>` in your command options will replace it with the result of the previous command. "true" or "false" results will not pass to the next command.
-
Adding "True" or "False" at the end of the command will only trigger that command if the previously run command returns "true" or "false". For example, using "alertTrue" as the command name will only run that command if the previously run command returned "true".
Note: The result state is persistent, so you can have one "path" command. For example, return "true" and then multiple commands following it with "False" in the command name. None of the "False" commands would run.
-
The "true" and "false" commands can be used to clear any previous results in the command set.
Workflow
-
On launch, Jamf Connect Verify searches the com.jamf.connect.actions preference domain and reads any actions.
-
Jamf Connect Verify executes the shown command set.
Note: All commands in the Show command set must return true for the menu item to display.
-
For items that pass the Show test, Jamf Connect Verify will then run the Title command set to get the text of the menu item. If no command set has been configured, the Action name will be used instead.
-
An item that is selected will cause the item's Action command set to be run.
-
Following the Action set running, the Post set will then be run acting on the result of the Action set.
-
Every time Jamf Connect Verify updates (every 15 minutes, network change, or Jamf Connect Verify menu interaction) the Action items will be updated with the same process.
URIs
Actions will respond to jamfconnectverify://action/ActionName URIs and can be executed with the following command:
open jamfconnectverify://action/DoSomething
For actions with a space in the name, or other upper ASCII characters, use standard percent encoding when listing them in the URI.
Note: When executing actions this way, the Title and Show command sets will not be executed.
Using jamfconnectverify://actionsilent/ActionName will run the specified Action command set, but not the corresponding Post command set.