AD Directory Binding - Computer Name

New Contributor II

I have a policy that runs at Enrollment Complete for DEP enrolled machines. The policy contains a .pkg with a postinstall script that prompts the tech for a computer name and then names the machine using scutil --set ComputerName, HostName and LocalHostname. I've also tried adding jamf -setComputerName and networksetup -setcomputername to the script. After the script runs I check all of those locations via terminal and all return the new, correct name.

The policy also includes a JAMF Directory Binding for Active Directory. When this policy runs it binds the machine to AD using the previous computer name.

My question is: Where does the JAMF Directory Binding task pull the computerID info from for the bind?


Valued Contributor III
Valued Contributor III

Are you sure that the AD bind is happening after the computer name change and not before?

New Contributor II

According to the logs, the Name Change is the first thing to happen (as it should because I've given it a priority of 2), then other software is installed, scripts are run, and then the AD bind happens at the end. The terminal checks that I've done were while the additional software was being installed, after the name change and before the bind.


I was just working on this earlier this week.

So it turns out that the JAMF Directory Bind takes the hostname at the START of the policy execution as the name to bind it with.

I ended up making two policies to solve this:
1) Runs the Computer name prompt/change script then calls a jamf policy custom trigger to a policy
2) Sets to execute at the custom event to perform the binding.

Valued Contributor

Thanks Marker.43

New Contributor II

Yes, thanks @Marker.43. I did modify my naming policy to call another policy to perform the bind, and it works ok.

New Contributor

Hi @bharris, I am new to DEP and am now facing a similar Computer Name problem to the one mentioned in this discussion. Would you be able to share your postinstall script that prompts the tech for a computer name? I would like to use it as part of my imaging process. Thanks.