Posted on 04-11-2017 02:06 AM
Hi Nation,
My goal is to create a pkg or a script that will run if Ethernet Cable is removed from an iMac and it will lock that machine.
But I am "stucked" on Lock Computer Command.
My question is: Is it possible to run the command using Terminal application?
Many thanks in advance.
Posted on 04-11-2017 02:11 AM
You could just send the command "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -suspend"
Hope that helps.
Posted on 04-11-2017 02:55 AM
Hello @cddwyer many thanks for your reply.
Really appreciated your quick feedback but is not exactly what I am searching for.
My goal is to block the Machine with a Pin Code.
Many thanks in advance
Posted on 04-11-2017 07:54 AM
The only possible way right now to do this is by using the Jamf API, which would trigger an APNs command against that device, which in turn would need an internet connection.
You said you wanted to run this when an Ethernet cable is disconnected, which is a bit odd. What exactly is the issue you're looking to solve? Will the Mac have a Wi-Fi connection when Ethernet is unplugged? Because if not, there's no way the Mac will receive the APNs command to lock it. It's not possible to do that kind of pin lock with a local shell command.
Posted on 12-01-2017 07:13 AM
If you can figure out how to trigger it locally, put in a script with a check for ethernet connection at the beginning, then into a policy and make it available offline and set the trigger to 'at network state change'.
Hope that helps.
Posted on 12-01-2017 05:42 PM
you should be able to modify one of those scripts that check if there is an Ethernet connection, then disable wifi. It could be a launch daemon on the client.
L