Need an applescript (which I haven't used before) to deploy our VPN connection settings on our remote workers mac boxes. this is for PPTP VPN.
Upon googling I came across the following link :
http://discussions.apple.com/thread.jspa?messageID=10368307
But still I can't :
a) seem to name the VPN connection
b) give it a pptp vpn server address
c) give dns, default gateway and any custom routes for this vpn to work.
How can I add those fields / enteries in ?
tell application “System Preferences”
reveal pane “Network”
activate
tell application “System Events”
tell process “System Preferences”
tell window 1
click button “Add Service”
tell sheet 1
click pop up button 1
click menu item “VPN” of menu 1 of pop up button 1
delay 1
click pop up button 2
click menu item “PPTP” of menu 1 of pop up button 2
click button “Create”
end tell
click button “Apply”
end tell
end tell
delay 1 — optional (just for visual feedback)
keystroke “w” using {command down}
end tell
end tell
The above script seems to create the connection just fine but without the details - and I am not sure about what syntax I would use to get this going.
Thanks for your input!
Regards
Thanks
Rihatum, here's the full Applescript with all the things you want to do.
--create new VPN PPTP service on the ethernet interface
do shell script "networksetup -createnetworkservice \"VPN (PPTP)\" en0 - where en0" with administrator privileges
--set the IP, subnet, & router IP ( order = ip subnet route )
do shell script "networksetup -setmanual \"VPN (PPTP)\" 192.168.2.50 255.255.255.0 192.168.2.1" with administrator privileges
--set VPN service using DHCP -- if using DHCP don't use manual setting above
do shell script "networksetup -setdhcp \"VPN (PPTP)\"" with administrator privileges
--set DNS
do shell script "networksetup -setdnsservers \"VPN (PPTP)\" 208.67.222.222" with administrator privileges
--set search domain
do shell script "networksetup -setsearchdomains \"VPN (PPTP)\" my_company_domain.com" with administrator privileges
--rename network service -- replace CISCO_VPN with your preferred name
do shell script "networksetup -renamenetworkservice \"VPN (PPTP)\" CISCO_VPN" with administrator privileges