

This function asks the JAMF Pro API to return the client identifiers and computer names of all of the machines stored in the JAMF database.

Print("alt MAC: %s" % self.alt_mac_address) Grabbing the clients # simple reusable object to define a Computer The print_myself function is not used as in the script and is left for future usage. The _init_ section is called when the object is created and sets the initial state of the variables.

It stores the variables that we will compare later. This is an object that we can pass back and forth between functions. Let’s take a closer look at the major sections of the overall script. Print out a summary for each dictionary by checking each key for values with more than one client ID.If it doesn’t, create a new pair in the dictionary with the piece as the key and the client identifier as the value.If it does, add the client identifier to the value for that piece.Does this piece of information exist in the dictionary?.For each client and each dictionary do the following:.Define a dictionary for each of those pieces.For each client, ask the JAMF server for specific pieces of information.Ask the JAMF server for the list of computers and their identifiers.In broad strokes here is how the script works:

The next time we find a machine named “MacBook Pro”, we’ll add it’s ID to the list of IDs stored in the value field. For example, if we have a machine with a computer name “MacBook Pro”, we’ll store the name as the key and the first client ID is stored as the value.
#Jamf api scripts serial
This script stores the attribute (computer name, serial number, etc) as the key, and the value is a list of the clients that share that value. While you normally wouldn’t change the content of the key, changing the value field is a very powerful feature. In the case of the example image, authors. The value portion of the pair can be any kind and quantity of data. They could just as easily be phone numbers or dates, for example. In the image below, the keys are book title, or strings. This singular key can be any of a number of different data types. A dictionary is a list of key and value pairs. This script makes good use of Python’s dictionaries or associative arrays. We have additional related posts coming soon that look at searching and writing data to the JAMF Pro database using Python. This article builds on topics covered in Fetching Data From the JSS using API calls & Python. But by combining the JAMF Pro API and the power of Python, we can quickly find these offending entries. At this time the JAMF Pro server does not offer much in its UI to track down these duplicates. A 409 error denotes a resource conflict, usually caused by multiple machines sharing an identical value for a field which should hold a unique value. This issue required us to use the JAMF API and script a solution to add these machines with software-defined UUIDs.ĭuring our cleanup of the database we discovered that while the machine may have been successfully added to the database, it may have additional database fields that duplicated other machines information and cause HTTP 409 errors when attempting to modify their records using the API. If you’ve experienced this issue in your deployments, we invite you to visit and vote for our feature request here: Add flag to jamf.exe to specify UUID of my choosing during enrollment.
#Jamf api scripts windows
Unfortunately, the JAMF’s Windows client tools don’t offer the ability to define an alternate UUID. Compounding this was the discovery that the Window’s computers we were adding had motherboards with identical information ( UUIDs and serial numbers, for example) making it difficult or impossible for the JAMF database to distinguish one machine from another. These errors resulted in duplicate and incomplete entries scattered among the legitimate machines. While building out our database, we conducted a large number of tests and mistakes were made while adding machines. We’ve been attempting to develop a unified inventory solution for all of our computers using JAMF Pro. 4 Likes No matter where you go, there they are…
