Change VPN profile username from script

rangiitsp
New Contributor

Hello everyone,

 

I've been searching high and low for a way to be able to update the username in a VPN profile based on the user who is logged in. We are currently using a configuration profile which works only when only 1 person uses a Macbook but as soon as a 2nd user logs in, the username of the 1st user remains in the VPN settings when the 2nd user tries to connect.

 

Has anyone managed to find a way around this?

2 REPLIES 2

Jamfpire
New Contributor III
currentUser=$(who | awk '/console/{print $1}')

 

You could try using this command to pull the currently logged in user, then add it to your script, then create a launch daemon/agent to run on login.  

Thanks. I know how to get the username, it's the actual updating of the VPN profile with that username that's the problem. There seems to be no easy way to do it.