Trigger Policy on Network Drop

nick_church
New Contributor

Hi there, I've created a small script that pings a few IP addresses and compiles the results in a text file on the user's desktop for the purposes of diagnosing network problems. My plan is to push this into everybody's /Applications/Utilities folder so that when we have outages we can direct them there. I also had an idea to have the app automatically appear on a user's dock if they currently have no internet access, but I'm not sure if that's even possible. Is there any sort of custom trigger I could use to modify a user's dock whenever they are offline?

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Hmm. There are a couple of possibilities here to get this to work. One is, you can look at deploying an offline policy from Jamf Pro that triggers on network state change that runs a script, determines if the Mac is able to see your network, and if not, runs some commands to add the app/script into the user's Dock via something like dockutil.

The second way I can think of doing this would be with a LaunchAgent that also triggers on network state change and does essentially the same things as above - checks for your network and either exits if it can see it, or drops the utility into their Dock if it cannot.

I have to ask though, why not simply deploy it to their Dock and keep it there? Is there some reason to only place it there when they are off the network as opposed to on it?

Outside of these, you may want to consider also looking at items like custom menu bar items. There are a few tools out there that can let you create menu bar items that can do a variety of different things, including running the diagnostic commands you mentioned. It should be easy to create one that alerts the user when the network connection has dropped and changes the status menu icon to indicate as such.

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

Hmm. There are a couple of possibilities here to get this to work. One is, you can look at deploying an offline policy from Jamf Pro that triggers on network state change that runs a script, determines if the Mac is able to see your network, and if not, runs some commands to add the app/script into the user's Dock via something like dockutil.

The second way I can think of doing this would be with a LaunchAgent that also triggers on network state change and does essentially the same things as above - checks for your network and either exits if it can see it, or drops the utility into their Dock if it cannot.

I have to ask though, why not simply deploy it to their Dock and keep it there? Is there some reason to only place it there when they are off the network as opposed to on it?

Outside of these, you may want to consider also looking at items like custom menu bar items. There are a few tools out there that can let you create menu bar items that can do a variety of different things, including running the diagnostic commands you mentioned. It should be easy to create one that alerts the user when the network connection has dropped and changes the status menu icon to indicate as such.

nick_church
New Contributor

Thanks! I'll look into those options. I'd like to do it this way mainly because I don't want to clutter up people's docks unnecessarily. I have a lot of developers that are very particular about how they've set things up and I prefer to only impose upon them when needed.