self-service macbook jss script to flush client dns?

Malcolm
Contributor II

wondering anyone has a working script to flush the end user's DNS?

The terminal command for sierra is: sudo killall -HUP mDNSResponder

but I need a script so it will run without user auth.

Scenario
we are a huge apple school, over 2500 clients, we recently had to carve up our network into class c subnets per year level, so reduce bonjour flooding our wifi radio channels (the waps and wired network didn't blink an eye lid but it was occurring at the radio transmission level - a pain to diagnose).

After carving up the network, we implemented papercut mobile printing solution valuable with version 17, but being a multi subnet network, we enabled their multi subnet DNS solution, which works but we have been experiencing random issues which I have only been able to observe as a possible local dns cache issue, where users are coming in from home, and haven't received the DNS settings from the onsite DNS server.

I was hoping to implement a on network change script command which would flush the end user's DNS cache, to ensure it was collecting clean DNS data directly from our DNS server, and not something it might be still referring to from home.

1 REPLY 1

jhalvorson
Valued Contributor

If you offer this as a self service policy, then it will run with admin rights. The two options are to include in the policy that command as either as Script or it be an entry in Files and Processes >> Excute Command.

But if DNS is not correct on the client, the client might not be able to connect to the JSS, then Self Service will only generate an error when the SS app is opened.

You could make a policy with that command in a script. Then set the policy to run at startup and make available off line. If a client is having trouble, they could reboot the Mac while it is connected to the school's network.