Changing client computer names using a Munki nopkg

In Another opinionated guide to Munki manifests, I said one of the benefits of having no ClientIdentifier and using serial numbers as manifests was not having to manually change preferences on the machine if you repurpose it.

What if you want the machine name to change, though? It used to be something like Basketball01, and now you want it to be Music05, for example.

You can make that change by simply adding this ComputerFromDisplayName nopkg to the client's serial number manifest (or one of its included manifests).

What the nopkg script does is check that the client manifest has been downloaded to the client machine (usually has after one Munki run, but can't hurt to verify), checks that the downloaded manifest has a display name, and then sees if the display name differs from the computer name. If the two names differ, the script changes the computer name (and the hostname and local hostname) to match the display name.

So you would just add this to the manifest, change the manifest's display name, and then on the next Munki run, it would change the computer's name to match the display name you set earlier.

Leave a Reply

Your email address will not be published. Required fields are marked *