Posted on 11-03-2014 11:48 AM
I would like to offer my users to be able to repair their network connection in case they are having issues connection to the internet. Since they don't have admin rights they are limited on what they can do. I was looking for a way to script this. I know on windows all you have to do is ipconfig /release and then ipconfig /renew and that usually refreshes your IP addresses. Is it possible to script this or is anyone here offer this as a self service item??
Posted on 11-03-2014 11:55 AM
@asegura, if the Mac has issues connecting to the Internet... How will they connect to Self Service?
Might be better at looking at an AppleScript app that runs some shell commands to "fix" the connection.
Posted on 11-03-2014 12:05 PM
I was thinking the same thing. Self Service.app requires a connection to the JSS to work at all, which would mean a valid network connection. Its really just a browser of sorts.
If the users aren't admins, coming up with something for this could be very tricky.
Only thing I can think of is to create a LaunchDaemon that uses a WatchPath file or folder that is writable by a non admin user. Create a simple Applescript or Applescript app, etc that writes a value to the file/folder that the LaunchDaemon sees and then runs a script to correct their network connection (if it can)
Edit: Actually, the above would only be necessary if the commands you need to run require admin rights (root). I'm not certain if it would.
Posted on 11-03-2014 01:55 PM
@bentoms you have a valid point. Not sure what I was thinking I guess I will chalk this up to a Monday :). But if I wanted to create a self service policy that will renew their DHCP is that possible?
Posted on 11-03-2014 04:28 PM
So does Self Service need an offline mode for cached policies? :)
Posted on 11-03-2014 04:38 PM
@davidhiggs, already requested a while ago- https://jamfnation.jamfsoftware.com/featureRequest.html?id=222 :)
Since Self Service is really just loading a web page, I don't see why it couldn't be directed to a local web cache on the Mac for any cached policies. I think it would be a neat feature to be able to set up offline cached policies to show up in a special 'limited' Self Service mode that would load if the Mac didn't have a connection back to the JSS, or even if it didn't have an active network connection, although that last option would be a little tricky, since its possible some cached SS policies might still require an internet connection of some kind to work at all.
Posted on 11-04-2014 12:08 AM
To renew a lease you'll need to work out which port is active and then run the following (setting the variable activeNetworkPort as, for example, en0)
Needs to run as root.
echo "add State:/Network/Interface/${activeNetworkPort}/RefreshConfiguration temporary" | scutil
You could use something like Platypus to wrap a script into your own Self Service application.