Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
bcross1919
New Contributor

Forticlient Configuration Script-Mapping Network Drives

I'm using Forticlient 5.2 and have been trying to tailor a configuration for the Forticlient that will on connect, run a vbscript and map network drives and then on disconnect, run a command to clear those drives.

 

I have had success with using the XML configuration file to run the vbscript on connect, but I can't seem to get the on_disconnect portion of the script working correctly. The on_connect portion works just fine, but the on_disconnect doesn't.

 

With this config file, is it that you can only run one or the other, or is it designed to run both. Frankly, there isn't a lot of information on configuring this file. Any help would be appreciated.

5 REPLIES 5
Aies
New Contributor II

bcross1919 wrote:

I'm using Forticlient 5.2 and have been trying to tailor a configuration for the Forticlient that will on connect, run a vbscript and map network drives and then on disconnect, run a command to clear those drives.

 

I have had success with using the XML configuration file to run the vbscript on connect, but I can't seem to get the on_disconnect portion of the script working correctly. The on_connect portion works just fine, but the on_disconnect doesn't.

 

With this config file, is it that you can only run one or the other, or is it designed to run both. Frankly, there isn't a lot of information on configuring this file. Any help would be appreciated.

Hi bcross1919 

I stumbled upon your post while I was looking at my issue with mapping the network drive in the first place using the <on_connect> portion. My VPN connects fine but as I just said the network drive doesn't map. My <on_connect> portion of the XML file looks like this: 

<on_connect> <script> <os>windows</os> <script> <script> <![CDATA[net use U: \\Server IP\Folder\Share]]> </script> </script> </script> </on_connect>

 

I tried to keep it as simple as possible for testing purpose. Do you have any idea what I am missing? 

Sorry for not being able to help you out with your problem, Thanks in advance

bcross1919

inuit wrote:

bcross1919 wrote:

I'm using Forticlient 5.2 and have been trying to tailor a configuration for the Forticlient that will on connect, run a vbscript and map network drives and then on disconnect, run a command to clear those drives.

 

I have had success with using the XML configuration file to run the vbscript on connect, but I can't seem to get the on_disconnect portion of the script working correctly. The on_connect portion works just fine, but the on_disconnect doesn't.

 

With this config file, is it that you can only run one or the other, or is it designed to run both. Frankly, there isn't a lot of information on configuring this file. Any help would be appreciated.

Hi bcross1919 

I stumbled upon your post while I was looking at my issue with mapping the network drive in the first place using the <on_connect> portion. My VPN connects fine but as I just said the network drive doesn't map. My <on_connect> portion of the XML file looks like this: 

<on_connect> <script> <os>windows</os> <script> <script> <![CDATA[net use U: \\Server IP\Folder\Share]]> </script> </script> </script> </on_connect>

 

I tried to keep it as simple as possible for testing purpose. Do you have any idea what I am missing? 

Sorry for not being able to help you out with your problem, Thanks in advance

Try this:

<on_connect> <script> <os>windows</os> <script> <script> <![CDATA[

net use U: \\Server IP\Folder\Share

]]> </script> </script> </script> </on_connect>

 

kolawale_FTNT

bcross1919 wrote:

...

With this config file, is it that you can only run one or the other, or is it designed to run both. Frankly, there isn't a lot of information on configuring this file. Any help would be appreciated.

The <on_disconnect> script runs after the VPN tunnel has been disconnected. If the network drives are only available while the tunnel is up, they will no longer be accessible by the time the <on_disconnect> script runs.

 

In Linux, umount has both a lazy and a force option, allowing you to unmap a file system locally, whether or not the remote location is still reachable. I wonder if Windows have similar options.

bcross1919

kolawale_FTNT wrote:

bcross1919 wrote:

...

With this config file, is it that you can only run one or the other, or is it designed to run both. Frankly, there isn't a lot of information on configuring this file. Any help would be appreciated.

The <on_disconnect> script runs after the VPN tunnel has been disconnected. If the network drives are only available while the tunnel is up, they will no longer be accessible by the time the <on_disconnect> script runs.

 

In Linux, umount has both a lazy and a force option, allowing you to unmap a file system locally, whether or not the remote location is still reachable. I wonder if Windows have similar options.

The thing is, I can't get anything to run using the <on_disconnect> option. I've tried doing a call to an .exe, or to a text file, just to see that it would run something and it won't run any batch command you call for. You can still clear drives using the net use * /DELETE /Y option after they've been disconnected. I've even done this by running a batch script with this command after the fact and it works.

The <on_disconnect> option just isn't working at all. And I'm not sure why.

Also, the XML reference documentation shows this example:

 

<on_disconnect> <script> <os>windows</os> <script> <script> <![CDATA[ net use x: /DELETE ]]> </script> </script> </script> </on_disconnect>

 

So this is what they were intending when making this available.

 

 

Antar
New Contributor

Hi I'm facing a similair problem.

 

Can't connect to network map drives , can anyone help with a script  to add to conf file ?

 

the others problem is we use a group check , if user A belong to groupA , connect the map drive A etc..

 

I tried to add a commands net use but it's doesn't work.

 

Thx

 

Labels
Top Kudoed Authors