Posted on 03-25-2025 06:27 AM
Hey all.
Is there a way to lock access to the WiFi settings on a macbook only during certain time periods combined with when a non-admin user is logged in? We're having issues with our students using their hot spots and want to lock the computers to the campus WiFi durring class times.
Posted on 04-01-2025 04:45 PM
You can do with 2 launchagents and 2 scripts, just write a script to turn off wifi and mechanism to check if user admin, second launchagent/script to do opposite
script and launchagent examples below:
#!/bin/bash
if groups $(whoami) | grep -q "\badmin\b"; then
echo "User is an admin."
else
echo "User is NOT an admin. Turning off wifi"
networksetup -setairportpower en0 off
fi
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.wifiscript</string>
<key>ProgramArguments</key>
<array>
<string>/path_to_your_script.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>