I have implemented a VPN auto connect option via Applescript [see code]. It works like a charme there's only one problem. Every time when i open my MacBook I get this [see printscreen] notification. A few seconds later it reconnects as it should. How can I stop that notification from showing up? It's very annoying.

on idle
tell application "System Events"
    tell current location of network preferences
        set myConnection to the service "my vpn name"
        if myConnection is not null then
            if current configuration of myConnection is not connected then
                connect myConnection
            end if
        end if
    end tell
    return 120
end tell end idle

It's Dutch (sorry for that ;)) It says "Connection has been broken, Please try reconnecting


The problem comes because the VPN server is killing the connection sometime after the mac goes to sleep.

Try disconnecting the VPN before going to sleep, automatically, using sleepwatcher as described in this Q&A.