Updating management status in Jamf Pro computer inventory records using the Jamf Pro API
嗯,用户让我帮忙总结一下这篇文章的内容,控制在100个字以内,而且不需要用“文章内容总结”或者“这篇文章”这样的开头。直接写描述就行。 首先,我需要通读整篇文章,抓住主要信息。文章讲的是如何使用Jamf Pro API更新设备的管理状态。作者之前写过一个脚本,现在更新了这个脚本,改用新的API端点。他不仅写了设置为Managed的脚本,还写了设置为Unmanaged的脚本,并且提供了详细的使用说明和GitHub链接。 接下来,我要把这些信息浓缩到100字以内。需要包括:使用API更新管理状态、提供两个脚本、支持Managed和Unmanaged状态、需要输入 Jamf Pro ID列表、以及GitHub上的资源。 然后,检查一下有没有遗漏的重要点。比如,脚本的输入要求、权限需求等,但可能这些细节在100字内无法详细描述。 最后,确保语言简洁明了,直接描述内容,不使用任何开头语。 </think> 文章介绍了如何通过Jamf Pro API更新设备的管理状态(Managed或Unmanaged),并提供了两个脚本(Set_Jamf_Pro_Computers_To_Managed_Status.sh和Set_Jamf_Pro_Computers_To_Unmanaged_Status.sh)来实现这一功能。脚本支持批量处理,并生成TSV格式的报告。资源可在GitHub上获取。 2025-12-12 17:19:17 Author: derflounder.wordpress.com(查看原文) 阅读量:4 收藏

Home > Jamf Pro, Jamf Pro API, Scripting > Updating management status in Jamf Pro computer inventory records using the Jamf Pro API

Updating management status in Jamf Pro computer inventory records using the Jamf Pro API

A while back, I wrote a post on how to set Jamf Pro computer inventory records to be managed using a script. I recently revisited this script as part of a general effort on my part to update scripts which have been using the now-deprecated computers Classic API endpoint, to now use the Jamf Pro API’s computers-inventory-detail API endpoint.

As part of this effort, I decided to not only update my existing script for setting the management status in Jamf Pro computer inventory records to be managed but also write a second script for setting the management status to be unmanaged. For more details, please see below the jump.

You can set the management status in a Jamf Pro computer inventory record using the computers-inventory-detail endpoint for the Jamf Pro API. The API command to change the management status in a Jamf Pro computer inventory record to Managed should look similar to this:


It’s sending the following JSON block to update the relevant computer inventory record and make the management change:


{
"general": {
"managed": "true"
}
}

The API command to change the management status in a Jamf Pro computer inventory record to Not Managed should look similar to this:


It’s sending the following JSON block to update the relevant computer inventory record and make the management change:


{
"general": {
"managed": "false"
}
}

I was able to use the API information discussed above to create a couple of scripts which a) update the management status in specified computer inventory records and b) generates a report of the Macs whose computer inventory records were updated.

The scripts are named Set_Jamf_Pro_Computers_To_Managed_Status.sh and Set_Jamf_Pro_Computers_To_Unmanaged_Status.sh and are available via the links below:

https://github.com/rtrouton/rtrouton_scripts/tree/main/rtrouton_scripts/Casper_Scripts/Set_Jamf_Pro_Computers_To_Managed
https://github.com/rtrouton/rtrouton_scripts/tree/main/rtrouton_scripts/Casper_Scripts/Set_Jamf_Pro_Computers_To_Unmanaged

Both scripts are designed to take in a set of Jamf Pro ID numbers in a plaintext file, where the Jamf Pro ID numbers correspond the Macs where you want to change the management status in their Jamf Pro computer inventory records. The plaintext file should look similar to this:


416462
842736
434703
338517
481915
596669

Four items are required to use these scripts:

  • A text file containing the Jamf Pro IDs of the computer(s) you wish to delete.
  • The URL of the appropriate Jamf Pro server.
  • The username of an account on the Jamf Pro server with sufficient privileges to delete computers from the Jamf Pro server.
  • The password for the relevant account on the Jamf Pro server.
  • Jamf Pro account privileges required by the Jamf Pro server account referenced above:

Jamf Pro Server Objects:

  • Computers: Read, Update
  • Users: Update

Once the four specified items are available, the scripts can be run using the following commands:

For Set_Jamf_Pro_Computers_To_Managed_Status.sh:


/path/to/Set_Jamf_Pro_Computers_To_Managed_Status.sh /path/to/plaintext_filename_here.txt

For Set_Jamf_Pro_Computers_To_Unmanaged_Status.sh:


/path/to/Set_Jamf_Pro_Computers_To_Unmanaged_Status.sh /path/to/plaintext_filename_here.txt

For Set_Jamf_Pro_Computers_To_Managed_Status.sh, you should see output that looks like this:

As part of the script’s run, a report will be generated and you’ll be notified of where it is stored. The report will be in TSV format and appear similar to what’s shown below:

For Set_Jamf_Pro_Computers_To_Unmanaged_Status.sh, you should see output that looks like this:

As part of the script’s run, a report will be generated and you’ll be notified of where it is stored. The report will be in TSV format and appear similar to what’s shown below:

In addition to the scripts described above which use user accounts for authentication, there are also matching scripts which use API client authentication available on GitHub via the links above. If setting up an API client with limited rights, here are the required API role privileges for the API client on the Jamf Pro server:

  • Computers Read
  • Computers Update
  • Users Update

文章来源: https://derflounder.wordpress.com/2025/12/12/13154/
如有侵权请联系:admin#unsafe.sh