Posted on 10-24-2016 03:46 PM
I am testing enrolling new Macs in DEP, applying a configuration profile and then using policy to push software and other things.
Before we would setup the Mac normally, name the Mac and run the Casper Enroll package. I am trying to make it easier for our guys to deploy Macs. Right now DEP and the config profile does everything I want but I am still stuck naming the Mac manually and then binding to AD.
Is there anyway to name the Mac during setup? I can't just have a generic name, we have very specific naming guidelines to identify the department and that it is a Mac. I would like to able to do this and have it bind to the domain so our Techs really have to do nothing really. I would also like this so I can hide the sharing preference pane as we have some users that find it necessary to change their Macs name.
Solved! Go to Solution.
Posted on 10-24-2016 06:12 PM
There is no automated way of doing this straight out of the box.
We use a script that prompts the user to input a computer name (Asset ID)
#!/bin/sh
computerName=$(osascript -e 'tell application "SystemUIServer"
set myComputerName to text returned of (display dialog "Please insert your Asset ID number and click Submit." default answer "" with title "Asset ID" buttons {"Submit"} with icon caution)
end tell')
/usr/sbin/scutil --set ComputerName "${computerName}"
/usr/sbin/scutil --set LocalHostName "${computerName}"
/usr/sbin/scutil --set HostName "${computerName}"
dscacheutil -flushcache
echo "Computer name has been set..."
echo "<result>`scutil --get ComputerName`</result>"
exit 0
Then we use the jamfHelper to display the "Software is installing" screen whilst the machine is installing mandatory apps!
Posted on 10-25-2016 06:26 AM
You can set the name in the prestage enrollment settings using the Client ID option, and utilize JSS variables. For instance, we name all our DEP macs: mac-username
That username is pre-popluated based on the user the mac is assigned to in the JSS or what user authenticates in the setup assistant upon first boot.
Posted on 10-24-2016 03:51 PM
ditto here i need the same info
Posted on 10-24-2016 04:07 PM
It is not possible out of the box. You'd need to do your own scripting to make that happen.
For our environment we had to do it through a combination of scripts that talk to the API and a JSS Events API plugin that my counterpart wrote in java.
When the machine is added to the JSS that fires off a JSS Event which triggers the plugin, which triggers the script that checks the API to see if the machine was enrolled via our Pre-Stage and if it was, to build the name for the machine based on our standard, changes the name of the computer in the computer inventory record via the API, and adds it to a group that has a policy scoped to it with the "rename machine to match the name in the inventory record" payload.
At some point when we re-do the workflow as webhooks then we will probably put that up on github but right now its kind of a mess and only applicable to our environment.
Posted on 10-24-2016 04:16 PM
We use a script that activates on first login and the user sets the name of the computer. i.e. Serial #.
Here is the script:
#!/bin/sh
function askForNewName ()
{
echo "Please Input Computer Name:"
read COMPUTERNAME
}
askForNewName
if [[ ${#COMPUTERNAME} -le 15 ]]; then
echo "Valid name"
scutil --set HostName $COMPUTERNAME
scutil --set LocalHostName $COMPUTERNAME
scutil --set ComputerName $COMPUTERNAME
exit 0
else
echo "The name "$COMPUTERNAME" is invalid. It it too long."
sleep 1
askForNewName
fi
I really can't think of a "automated" process to doing this. You would have to provide instructions to your users on how you want them named. *The names can't be long thought.
Source: https://www.jamf.com/jamf-nation/discussions/16743/running-rename-script-on-initial-enrollment
Posted on 10-24-2016 04:23 PM
@jared_f but if I or one of the Techs was the first to login, the same would apply correct?
Posted on 10-24-2016 06:12 PM
There is no automated way of doing this straight out of the box.
We use a script that prompts the user to input a computer name (Asset ID)
#!/bin/sh
computerName=$(osascript -e 'tell application "SystemUIServer"
set myComputerName to text returned of (display dialog "Please insert your Asset ID number and click Submit." default answer "" with title "Asset ID" buttons {"Submit"} with icon caution)
end tell')
/usr/sbin/scutil --set ComputerName "${computerName}"
/usr/sbin/scutil --set LocalHostName "${computerName}"
/usr/sbin/scutil --set HostName "${computerName}"
dscacheutil -flushcache
echo "Computer name has been set..."
echo "<result>`scutil --get ComputerName`</result>"
exit 0
Then we use the jamfHelper to display the "Software is installing" screen whilst the machine is installing mandatory apps!
Posted on 10-24-2016 07:28 PM
@dmitchell Yes, if you are the first to login on that computer, you should be able to set the name.
Posted on 10-25-2016 06:26 AM
You can set the name in the prestage enrollment settings using the Client ID option, and utilize JSS variables. For instance, we name all our DEP macs: mac-username
That username is pre-popluated based on the user the mac is assigned to in the JSS or what user authenticates in the setup assistant upon first boot.
Posted on 10-25-2016 09:27 AM
@ooshnoo I'm new to JSS; could you please describe where is that "Client ID" option in the JSS.
We don't have/ don't use DEP; but I was wondering if there's a "Policie" or a "Configuration Profile" where I can make sure the name of the "laptop" (macbook) it contains the username-mac (so it will be the same settings that you use only backwards "$USERNAME-mac")
(ps: we are using LDAP)
Posted on 10-25-2016 09:42 AM
@scentsy I am pretty sure he is referencing the directory binding configuration profile payload. So it would use that computer name to bind the machine to AD but I don't think it would actually change the sharing name of the computer. But I could be wrong.
Posted on 10-27-2016 06:49 AM
Depending on the naming convention you are using, you could possibly automate the entire naming process. Our naming process (don't get me started on how terrible of a naming convention this is) is <username>-M# where the number is 1-9, and based on the number of other machines that user has. When the user authenticates with DEP, we get the username, and we use and embedded account to query AD for the computer number. With all this info, we don't need to ask the user for the machine name, and instead are able automate the naming process. Hope that helps with some ideas!
Posted on 12-28-2016 09:29 AM
From what I understand you can use have it name to either the computer name (user's macbook), serial number, or UserID using different variables and also a prefix if needed. None of these work in our environment (like others) as we have standard naming conventions and continuing with that process is desired.
I understand a lot of this depends on Apple what all can be done through DEP. What I fail to understand though (have tried talking to JAMF numerous times about this) is why this can't still be resolved by JAMF.
If you are able to have some control over how the machine is named (ClientID Field) why can't that field be used to reference some unique feature of the machine (serial number / mac address) to some external source to obtain the ID to computer name matching? So when you receive machines you build the associations in a DB or JSS and when the machine is enrolled JSS looks up the mapping and places it essentially into the ClientID field the computer uses to find out what it should be named. Almost like building a dynamic PreStage for each machine you enroll. It seems like that would be one way to work around Apple not making this feature a part of their DEP.
If someone can explain to me why this isn't possible that would be great. I'm definitely not a programmer but with as much as this product is capable of doing I just fail to understand how something like predefined computer names isn't something that can be done natively with JSS and also take advantage of the benefits of this happening at time of enrollment.
For us, because many things rely on the computer being named properly things like domain bind can't happen during enrollment. My workaround for this is to create a CSV for the machines going through pre-stage that have the serial number and computer names populated. Once enrollment is complete a script is run which checks that csv for the correct naming, then renames the computer according to our standards. It works, but it makes the enrollment part not so intuitive to the end user and removes a lot of the cool benefits of DEP.
Posted on 10-31-2018 07:25 AM
I couldn't agree more, we are in dire need of such an option too!
Posted on 10-31-2018 07:53 AM
i worked around this by have some policies that unbind from AD, prompt for the computer name, change it, then kick off splash buddy to complete the rest of the setup. not a simple elegant solution, but it works.
Posted on 10-31-2018 09:34 AM
There's another thread somewhere regarding this, and someone posted an application called iNamer that pops up during Setup Assistant and names the machine, then you can have the policy that installs the iNamer app call your AD bind or any other policies you want. I'm in a meeting right now but I'll try and remember to go search for it and post it here.
Posted on 10-31-2018 09:37 AM
Just kidding, it was a Feature Request: https://www.jamf.com/jamf-nation/feature-requests/6193/dep-computer-naming, please vote it up.
However, I have a feeling that when Inventory Preload comes to Computers this might be a moot point.
Posted on 10-31-2018 09:45 AM
I have a script that prompts for the computer name during Setup Assistant. For it to work, you need it to run on enrollment trigger and you need to wait (30 seconds or so) at the Time Zone setup screen until this pops up. If you proceed past the Time Zone setup screen then _mbsetupuser is no longer logged in and the script will just exit.