Fortinet black logo

Administration Guide

Windows

Windows

Mapping a network drive after tunnel connection

The script maps a network drive and copies some files after the tunnel connects.

<on_connect>

<script>

<os>windows</os>

<script>

<script>

<![CDATA[ net use x: \\192.168.10.3\ftpshare /user:CMoltisanti md c:\test copy x:\PDF\*.* c:\test ]]>

</script>

</script>

</script>

</on_connect>

Always use #username#/#password# inline with the batch command, as follows:

net use \\myserver\fileshare /user:#username# #password#

Do not assign #username#/#password# to variables, like the following:

SET user=#username#

SET pwd=#password#

net use \\myserver\fileshare /user:%user% %pwd%

Deleting a network drive after tunnel disconnection

The script deletes the network drive after the tunnel disconnects.

<on_disconnect>

<script>

<os>windows</os>

<script>

<script>

<![CDATA[ net use x: /DELETE ]]>

</script>

</script>

</script>

</on_disconnect>

Windows

Windows

Mapping a network drive after tunnel connection

The script maps a network drive and copies some files after the tunnel connects.

<on_connect>

<script>

<os>windows</os>

<script>

<script>

<![CDATA[ net use x: \\192.168.10.3\ftpshare /user:CMoltisanti md c:\test copy x:\PDF\*.* c:\test ]]>

</script>

</script>

</script>

</on_connect>

Always use #username#/#password# inline with the batch command, as follows:

net use \\myserver\fileshare /user:#username# #password#

Do not assign #username#/#password# to variables, like the following:

SET user=#username#

SET pwd=#password#

net use \\myserver\fileshare /user:%user% %pwd%

Deleting a network drive after tunnel disconnection

The script deletes the network drive after the tunnel disconnects.

<on_disconnect>

<script>

<os>windows</os>

<script>

<script>

<![CDATA[ net use x: /DELETE ]]>

</script>

</script>

</script>

</on_disconnect>