When on a customer site or traveling for work, you will probably encounter a captive portal at some point. In my case, my Outlook personal folders and home directory are on corporate share drives and I need to re-establish the connectivity to the share before starting Outlook. Due to the captive portal, the VPN connection cannot be established after logging in so Windows never re-establishes the connections to the shares.
An easy way to automate the re-connection of the shares is to locate an event, ideally a VPN or network event, to use as a Task Scheduler Trigger.
Create a .cmd file using the following template save it.
Start the Windows Event Viewer and look for a useable event for the trigger. In my case, under Applications and Services logs I found an event logged upon successfully establishing the VPN connection.
After finding a suitable event, right click on it and select Attach Task to This Event.
Give it a name and description. Select Next
When an Event is logged. No updates. Select Next
Define the action. Select Start a Program radio button. Select Next
Browse to the Program/Script (command file) created and provide any optional arguments. Select Next.
Review the event and trigger and select Finish.
Now, log off and log back in. If all is correct then upon successfully establishing the VPN the script will be triggered and the shares will be reconnected.