You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
You are viewing the article in preview mode. It is not live at the moment.
Home > 410: Scripts & Triggers Manager > Knowledge Base > 02: Tip and Tricks > 13: How to use Scripts Manager Triggers to Map Network Drives when a VPN is Connected
13: How to use Scripts Manager Triggers to Map Network Drives when a VPN is Connected
print icon

Prerequisites:

 

  1. Create a new policy (Set Launch Folder Windows in a Separate Process to Enabled) using Scripts & Triggers on the computer side, choose switched-mode like in the screenshot below.

  2. At the “On apply action” screen select “PowerShell script” from the dropdown, then in the main text window, paste in the script below, check the option “Run script as user, then click “Next”.

  3. Then click “Next” at the “On revert action” screen to skip that screen, then at the “Specify process mode” screen choose the “Once” option.

  4. At the “Policy settings” screen give the policy a descriptive name then click “Finish. 

  5. Now create another policy (Map drives when VPN connects) using Scripts & Triggers on the computer side, choose switched-mode like in the screenshot below.

  6. At the “On apply action” screen select “PowerShell script” from the dropdown, then in the main text window, paste in the script below then change the drive mappings to match the settings needed for your environment, check the option “Run script as user, then click “Next”.

  7. Click “Next” at the “On revert action” screen to skip that screen, then at the “specify process mode” screen choose the “On trigger” option, then choose “VPN connect” from the drop down before clicking “Next” to continue.

  8. At the “Trigger settings” screen enter an asterisk (wildcard, etc.) for the server name, then click “Next”.

  9. At the “Policy settings” screen give the policy a descriptive name then click “Finish. 

    Note: You should have two policies now:

  10. Lastly, test the policy by logging into a computer, (or run gpupdate if already logged in) and then connect to a VPN as a user that should receive the policy. If everything works you should see the network drives show up in File Explorer, you may need to click refresh if you had File Explorer already open to update the window contents.

  11. Optionally, create a new Scripts and Triggers policy that disconnects the drives when the VPN disconnects by using the script below and also changing the trigger to “VPN disconnect”.

    Note: “On trigger” does not work with Revert action script which is why you need to create a new policy to disconnect the drives.

Feedback
0 out of 0 found this helpful

scroll to top icon