Posted on 06-01-2015 01:13 PM
Im looking for an easy way to set the computer name during the imaging process to have the department and then the serial number of the computer. Ive done some research but couldn't really find anything.
Posted on 06-01-2015 01:29 PM
You would have to script something like that.
One way I can think of, in Casper Imaging write the initials of the Dept in the computer name field then have a firstboot script that collects the computer name using and comes it with the serial number:
#Get computer name from JSS
JSSComputerName="$(/usr/bin/jamf getComputerName)"
#Get computer serial number
SerialNumber="$(/usr/sbin/system_profiler SPHardwareDataType | grep "Serial Number (system)" | awk '{print $4}')"
#Combine both computer name and serial number
NewComputerName="$JSSComputerName$SerialNumber"
#Rename computer in JSS
/usr/bin/jamf setComputerName "$NewComputerName"
Just a fair warning, I haven't tested this. And there may be other ways to tackle this as well, but it's the first thing that came to mind.
Posted on 06-01-2015 08:28 PM
As I think was mentioned by someone else on another similar thread from a few months back (and I admittedly had forgotten about), the jamf binary can do this all by itself:
#!/bin/sh
prefix="department_name"
/usr/sbin/jamf setComputerName -useSerialNumber -prefix "$prefix"
The above will set the Computer name to be department+serial number. You could add some delimiter into the prefix if needed to have some separation, like a dash for example.
Posted on 06-01-2015 10:50 PM
Posted on 06-03-2015 07:58 AM
I just tried what you suggested @mm2270 and not sure what I did wrong. I used the JSS Management Site and added a script then included that scrip in my configuration. Is there any more info you could give me?
Posted on 06-04-2015 05:16 AM
@rcs336 "JSS Management Site"?
Posted on 06-04-2015 10:30 AM
The website you use to manage casper settings. Sorry not sure what else to call it.
Posted on 06-04-2015 10:47 AM
That's often referred to as just the JSS (JAMF Software Server)
As for adding it in your configuration, I assume you mean your Casper Admin imaging configuration? If so, make sure the script is running after the Mac boots into the imaged OS. Also, you may want to check around on here for best practices regarding system naming scripts and imaging since some of these things need to be done in an exact order and can mess up the process if done too early (or even too late)
Since I don't use Casper Imaging (using DeployStudio with a custom post image process) its hard for me to guide you on exactly when this should run.