Skip to main content
Jamf Nation, hosted by Jamf, is a dynamic and knowledgeable community of Apple-focused IT admins and Jamf Pro users. Join us in person, in October, for the annual Jamf Nation User Conference (JNUC) to discover new and better ways to manage Apple devices.

setDNSServers.sh -- Set a DNS server for a specified network interface

Synopsis

sudo setDNSServers.sh
sudo setDNSServers.sh <mountPoint> <computerName> <currentUsername> <networkInterface> <dnsServer>

If the $networkInterface parameter is specified (parameter 4), this is the Netowrk Interface for
which DNS server that will be set. The expected values for the $networkInterface parameter can
be found by running the command:

networksetup -listallnetworkservices

If the $dnsServer parameter is specified (parameter 5), this is the DNS server that will be set.

If no parameter is specified for parameters 4 and 5, the hardcoded value in the script will be used.

Description

This script will set a DNS Server in the network settings for whichever network interface has been specified.

Download

Preview

Generating Preview...