I'm looking to make a set of options available to users via 2 policies in the Self Service app.
1 policy should allow the user to set a static IP address to the interface - I've written a script that inserts dummy values for now - this script runs successfully and alters the network settings as expected:
#!/bin/bash
# sets test IP settings for Ethernet
networksetup -setmanual Ethernet 10.10.10.10 255.0.0.0 127.0.0.0
The other policy should set the network settings back to DHCP for that interface - I wrote a script for this, which does not work:
#!/bin/bash
# Set network settings back to DHCP
networksetup -setdhcp Ethernet
This DHCP script reports as having run successfully (exit code 0) but the network settings on the device haven't changed.
If I run the single line with the networksetup command locally, in Terminal, it completes and changes the network settings as expected.
If I push the script out with a policy (as opposed to making it available in Self Service) it completes and changes the network settings as expected.
Any suggestions for troubleshooting / fixing this?
I've tried:
- using "ipconfig set en0 dhcp" instead - this hasn't worked
- giving networksetup the clientID parameter as suggested here - which didn't work: Solved: Automate Setting DHCP client ID to Hostname on Mac... - Jamf Nation Community - 172304
- running the script through ShellCheck - no errors found
I haven't yet tried:
- this suggestion, since I don't understand how to "Editing the policy in the JSS console then saving with no changes": Anyone else seeing Self Service policies with only... - Jamf Nation Community - 264005
Any help appreciated
A