manage DNS-extension

ErgodirektMac
New Contributor III

We must change the DNS-settings for our clients.
I would try to manage it by jamf to expand the computername with the domain for DNS.
i found a script at jamfnation but it changes the computername to "iMac" - that's not so good for us ;-)

so i wrote this to test it for me:

"#!/bin/bash
scutil --set HostName "Computername.ourdomain"
exit 0"

it works but i don't want to make this for each mac individually.
Is there a reason to set this for all clients ?

I found many scripts on jamfnation for DNS-Changes but tey all changes the ip-adresses.....

Kind regards,
Frank

2 REPLIES 2

DBrowning
Valued Contributor II

You can do something like this:

#!/bin/sh

cName=$(networksetup -getcomputername)
domain="domain.name"
scutil --set HostName "$cName.$domain.name"
exit 0

ErgodirektMac
New Contributor III

That's it

It works fine !!
Thanks for your support!!!