First some Basic Background
We are beginning to Use Apple DEP for new MAC's, so when they come, fresh out of the box, the user gets no Options, the MAC immediately looks at DEP and gets pointed at out JamfPro Cloud.
This is working great, we Have a Prestage Enrollment set up and working, so we just Add the new machine to the Scope and all is peachy.
The problem is that as an out of the box machine, it will default to a generic name "iMAC" or "MacbookPro" or "Mac Mini", this is no good to me as we have a strict naming standard to follow. The Prestaging via DEP does not seem allow for assigning a name in advance on a per machine basis, and believe me, although it would be useful to simply get the users to enter the name at a prompt, it's a no go option, and we want to try and make this as automated as possible.
So we are now looking like waiting for the machine to be plugged in, and as soon as it Enrolls we just manually update a field on its object and at next check in it will rename and then proceed to domain join.
My hope was to Have an Extension Attribute set up called "Target Computer Name" and use a Smart Group to compare it to the Computer Name, and if they didn't Match, launch a Script to rename the Machine and then possibly set another attribute to show it had been done so I could use it as a trigger for a Domain Join.
It appears Smart Groups wont allow comparison of 2 Attributes, so I looked at a script to do it.
My First Option was to use the "Target Computer Name" Extension attribute as a Variable for the script, Computer Name is automatically sent as Variable $1 so I was hoping that I could set Variable $4 as the contents of my Extension Attribute, apparently this is a No No as well.
I have been looking instead at a script to pull the "Target Computer Name" Extension Attribute directly using the API, do the rename if required and write a True/False to another Extension Attribute "Computername Matches" and use that as a trigger for my Domain Join next step. However it would appear a little tricky and every post I have found so far all look to do it in slightly differing ways, and none of them work, at least not on the version I am running (JAMF Pro 10.1.1 in the Cloud)
Can anyone offer help on this or possibly even some of the other methods I have already tried and failed with ?