Skip to content

jsmoriss/update-whd-client-is-asset-admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

update-whd-client-is-asset-admin.pl

Jamf Policy Script to Make WHD Asset Clients Admin on Login

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.

Jamf and WHD Requirements

  • 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 JSON decode_json() function and exit gracefully if the JSON module is missing.

Jamf Script Arguments

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)?

Jamf Policy

  • 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).

Jamf Policy Log Details

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).

About

Jamf Policy Script to Make WHD Asset Clients Admin on Login

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages