Category filter

Script to configure DNS settings for Wi-Fi on macOS

The Domain Name System (DNS) is the backbone of the internet, converting domain names into IP addresses that enable seamless communication between devices. It allows computers and servers to find and interact with each other over the internet.

Settings for the DNS server need to be changed on the device for various reasons. For instance, changing DNS settings can help load websites quicker, offer protection against malicious websites and phishing attempts, overcome region-based content restrictions, or prioritize user privacy by not logging DNS queries. Admins can execute the scripts below to set up a DNS server using Hexnode UEM’s Execute Custom Script action for Macs.

Scripting language- Bash

File extension-.sh

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

To configure a new DNS server

The following script can be deployed to configure the DNS server settings for Wi-Fi.

The script provided configures DNS server settings for Wi-Fi on a macOS system and displays the current DNS settings.

You can follow the steps to access the output.

  1. Login to your Hexnode UEM portal.
  2. Navigate to the Manage tab.
  3. Select the device for which you want to set up the DNS server.
  4. Go to Action History.
  5. You can find the option Output corresponding to the policy applied.

Configuration for DNS settings for Wi-Fi on macOS devices

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository