`jctl` uses `python-jamf` to select objects to create, delete, print and update. It allows performing Jamf Pro repetitive tasks quickly and provides options not available in the web GUI. It is similar to SQL statements, but far less complex.
MIT License
Bot releases are visible (Hide)
pkgctl updates multiple policies/groups at once. Example session:
[1 ] VMware Fusion PatchPolicies Policies Groups
VMware Fusion-12.2.4.pkg 2 1
VMware Fusion-12.2.5.pkg
Enter a number, or e[x]it/[q]uit: 1
VMware Fusion
VMware Fusion-12.2.4.pkg
Policies
[1] Install VMware Fusion 12
PatchPolicies
[2] VMware Fusion SS
PatchPolicies
[3] VMware Fusion Student Auto
VMware Fusion-12.2.5.pkg [no patch defined]
Enter one or more numbers, [b]ack, or e[x]it/[q]uit: 1 2 3
Pick the target package:
[1] VMware Fusion-12.2.4.pkg
[2] VMware Fusion-12.2.5.pkg
Enter a number, [b]ack, or e[x]it/[q]uit: 2
Published by github-actions[bot] 10 months ago
Published by magnusviri 10 months ago
Published by github-actions[bot] almost 2 years ago
jctl
pkgctl
Published by github-actions[bot] about 2 years ago
Fixed issue #53 , api.url
Published by github-actions[bot] about 2 years ago
-s
now can do !=~
-s
~=
is deprecated, switching it to =~
Example of the new features.
Getting the ID of the Zoom patch software title using jq
:
zoomid=`jctl patchsoftwaretitles -r "Zoom Client for Meetings" -p id -j | jq '.[].id | .[] | tonumber'`
Getting the ID of the Zoom patch software title using --print_id:
zoomid=`jctl patchsoftwaretitles -r "Zoom Client for Meetings" -I`
Using the ID
jctl packages -c "Zoom-5.11.11 (10514).pkg"
jctl patchpolicies -c "Zoom 1" $zoomid "5.11.11 (10514)"
Formatting the json output with jq
:
jctl computergroups -i 2 -j -l | jq
[
{
"id": "2",
"name": "All Managed Servers",
"is_smart": "true",
"site": {
"id": "-1",
"name": "None"
},
"criteria": {
"size": "2",
"criterion": [
{
"name": "Operating System",
"priority": "0",
"and_or": "and",
"search_type": "like",
"value": "server",
"opening_paren": "false",
"closing_paren": "false"
},
{
"name": "Application Title",
"priority": "1",
"and_or": "or",
"search_type": "is",
"value": "Server.app",
"opening_paren": "false",
"closing_paren": "false"
}
]
},
"computers": {
"size": "0"
}
}
]
Here's what it looks like when you specify paths.
jctl policies -n "Install Zoom" -p package_configuration -p general/name -j | jq
[
{
"package_configuration": {
"packages": {
"size": "2",
"package": [
{
"id": "1",
"name": "Zoom-5.11.11 (10514).pkg",
"action": "Install",
"fut": "false",
"feu": "false"
}
]
}
},
"general/name": "Install Zoom"
}
]
Non-json output shows the record name first (the output is still generated by pprint):
jctl computergroups -i 2 -l
{'All Managed Servers': {'computers': {'size': '0'},
'criteria': {'criterion': [{'and_or': 'and',
'closing_paren': 'false',
'name': 'Operating System',
'opening_paren': 'false',
'priority': '0',
'search_type': 'like',
'value': 'server'},
{'and_or': 'or',
'closing_paren': 'false',
'name': 'Application '
'Title',
'opening_paren': 'false',
'priority': '1',
'search_type': 'is',
'value': 'Server.app'}],
'size': '2'},
'id': '2',
'is_smart': 'true',
'name': 'All Managed Servers',
'site': {'id': '-1', 'name': 'None'}}}
Showing the record name first is very helpful when printing paths:
jctl computergroups -p is_smart
{'All Managed Clients': {'is_smart': 'true'}}
{'All Managed Servers': {'is_smart': 'true'}}
Count: 2
Comparing =~
with !=~
:
jctl computergroups -s name=~Cl
All Managed Clients
jctl computergroups -s name!=~Cl
All Managed Servers
Debugging output (yes, this shows the bearer token for my localhost server):
jctl computergroups --debug
2022-10-02 16:55:36,447: DEBUG: __main__ - main(): Warning, debugging output may contain passwords, tokens, or other sensitive information!
2022-10-02 16:55:36,447: DEBUG: __main__ - main(): args: Namespace(record='computergroups', create=None, update=None, delete=False, sub_command=None, id=None, name=None, regex=None, searchpath=None, print_id=False, long=False, path=None, json=False, quiet_as_a_mouse=False, config=None, version=False, use_the_force_luke=False, andele_andele=False, debug=True)
2022-10-02 16:55:36,494: DEBUG: jamf.api.API - _submit_request(): post: http://localhost/api/v1/auth/keep-alive
2022-10-02 16:55:36,759: DEBUG: jamf.api.API - _submit_request(): response.text: {
"token" : "eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiNGE0OGEyNzItZjFiZi00NjkwLWE5YjQtYTU4NjZkNDI2MGJlIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIxIiwiZXhwIjoxNjY0NzUzMTM2fQ.FEOy4rUenvZm3Gc_mrXk3qUnpcFmCtzneKKKs_hW-hk",
"expires" : "2022-10-02T23:25:36.754Z"
}
2022-10-02 16:55:36,832: DEBUG: jamf.api.API - _submit_request(): get: http://localhost/api/v1/jamf-pro-version
2022-10-02 16:55:36,860: DEBUG: jamf.api.API - _submit_request(): response.text: {
"version" : "10.41.0-t1661887915"
}
2022-10-02 16:55:36,861: DEBUG: jamf.api.API - _submit_request(): get: http://localhost/JSSResource/computergroups
2022-10-02 16:55:36,904: DEBUG: jamf.api.API - _submit_request(): response.text: <?xml version="1.0" encoding="UTF-8"?><computer_groups><size>2</size><computer_group><id>1</id><name>All Managed Clients</name><is_smart>true</is_smart></computer_group><computer_group><id>2</id><name>All Managed Servers</name><is_smart>true</is_smart></computer_group></computer_groups>
All Managed Clients
All Managed Servers
Count: 2
2022-10-02 16:55:36,922: DEBUG: jamf.api.API - __del__(): closing session
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] almost 3 years ago