If you use Jamf Pro and SolarWinds Web Help Desk (WHD), you may be interested in using this Jamf policy script to make WHD asset clients admin of their own assets on login.
- Assets in WHD must have accurate serial numbers entered. The script uses the computer serial number to locate the asset in WHD, so WHD assets must have serial numbers.
- Assets in WHD must have one or more clients assigned to them. Clients assigned to the asset will be added to the 'admin' group for that asset on login.
- The Perl script uses the JSON module, which Apple included in MacOS v11. If the computer uses an older MacOS version, the script will exit with an error. The script uses a
BEGIN{}section to handle importing the JSONdecode_json()function and exit gracefully if the JSON module is missing.
When adding the script to Jamf, you'll want to add these parameter labels:
- Parameter 4: WHD hostname?
- Parameter 5: WHD API username?
- Parameter 6: WHD API key?
- Parameter 7: Always admin usernames (optional)?
- Parameter 8: Fix extra admin users (default is false)?
- Trigger: Login
- Execution Frequency: Ongoing
- Parameter Values:
- Parameter 4: WHD hostname? example: helpdesk.mycompany.com
- Parameter 5: WHD API username? example: jsmith
- Parameter 6: WHD API key? example: yfi65OHG5hgu75IOgjhkdhte87JHGjhhjgjhgGJHG
- Parameter 7: Always admin usernames (optional)? example: sysadmin support
- Parameter 8: Fix extra admin users (default is false)? example: true
WHD requires a valid tech username for their API queries - any active tech username will do. :)
Note that parameter 8 is false by default. If parameter 8 is true, if the user is already part of the admin group and not a client of the asset in WHD, the user is removed from the admin group. Keeping this parameter false avoids two extra validation queries to the WHD database (ie. if the user is already admin, then do nothing).
The log details will show the script argument values (the API key is hidden) along with a message of each action taken.
For example:
mount_point = /
computer_name = COMPNAME
user_name = jdoe
whd_server = helpdesk.mycompany.com
whd_api_user = jsmith
whd_api_key = ********
admin_users = sysadmin support
fix_extra_admin = true
macos_version = x.x.x
retrieved asset id 123 tag ASSETTAG serial number FVFYJ3ACJK80.
retrieved client id 456 user name jdoe.
user jdoe is already admin of COMPNAME (FVFYJ3ACJK80).