by   April 18 2012   
This is a simple script that I made to map remote users to the FTP server after they connected via VPN. It also can map LAN NAS units and is simple for those that need things simple. Name the file FTP_LAN_MAP.vbs and modify the folder names and locations. You can use UNC instead of the FTP that I have in the script as well.

MAP FTP Folders over VPN or LAN to NAS

Map FTP Shares, Folders over LAN and map your NAS folders using FTP or UNC. Simple easy to mod script. You can add var to be more or less easier if you have to push folder access by user or computer name. I have other scripts that will show you how to map based on login, mac, computer name etc.

If you're planning on using this script for your remote desktop users you might want to look at the remote login log script.

This script was designed to be run after login. If you need to authenticate during this script look for the network login scripts that I've posted or have planned on posting.

If I recall this was inspired from the Scripting Guys answer 2005. I liked the format and if I remember it might be completely copied (plagiarized) from the article. Just in case time has played tricks on my memory credit for the Scripting Guy is included.

 Name the file: FTPFolderMappings.vbs

'------------------------------------------------------------------------
'Written by Murray W. 2010
'From the Article: Scripting Guy answer: Shortcut to Network places
'FTP Server Folder MAP Drive Script
'This script was developed to map drives over VPN connections to a LAN server or NAS.
'It was designed for Home Computer Users but has been modified over time
'You can use this to setup NAS mappings. I will post my examples
'
'All rights reserved. 
'This is provided without guarantees, expressed or implied
'You are responsible to test code and debug based on your configurations
'You are responsible for your script actions
'You assume all responsibility
'-------------------------------------------------------------------------

Set WSHShell = CreateObject("WScript.Shell")

Const NETHOOD = &H13&

Set objWSHShell = CreateObject("Wscript.Shell")
Set OWS = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self


intButton = OWS.Popup("Hello Computer User, would you like to setup your Local Private FTP Folders.",,"We will then copy files if needed.",36) 

If intButton <> 6 Then
    WScript.Quit
End if

strNetHood = objFolderItem.Path

strPath = objFolderItem.Path & "\*.*"

objFSO.DeleteFile strPath, true

'# FIRST FOLDER TO MAP AS FTP
strShortcutName = "FTP FOLDER ONE"
strShortcutPath = "ftp://192.168.0.5/Folder1/Name"

Set objShortcut = objWSHShell.CreateShortcut _
(strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save
Set objShortcut = Nothing

If Wscript.Version > 5 Then
   Wscript.Sleep 50
End If

intButton = OWS.Popup("Open "&strShortcutName&" now?",,"",36) 

If intButton = 6 Then
OWS.Run("%windir%\explorer "& strShortcutPath)
If Wscript.Version > 5 Then
  Wscript.Sleep 3000
End If
End if

'# SECOND FOLDER TO MAP AS FTP
strShortcutName = "FTP FOLDER TWO"
strShortcutPath = "ftp://192.168.0.5/Folder2/Name"

Set objShortcut = objWSHShell.CreateShortcut _
(strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save
Set objShortcut = Nothing

If Wscript.Version > 5 Then
   Wscript.Sleep 50
End If

intButton = OWS.Popup("Open "&strShortcutName&" now?",,"",36) 

If intButton = 6 Then
OWS.Run("%windir%\explorer "& strShortcutPath)
If Wscript.Version > 5 Then
  Wscript.Sleep 3000
End If
End if

'# THIRD FOLDER TO MAP AS FTP
strShortcutName = "FTP FOLDER THREE"
strShortcutPath = "ftp://192.168.0.5/Folder3/Name"

Set objShortcut = objWSHShell.CreateShortcut _
(strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save
Set objShortcut = Nothing

If Wscript.Version > 5 Then
   Wscript.Sleep 50
End If

intButton = OWS.Popup("Open "&strShortcutName&" now?",,"",36) 

If intButton = 6 Then
OWS.Run("%windir%\explorer "& strShortcutPath)
If Wscript.Version > 5 Then
  Wscript.Sleep 3000
End If
End if


Set WSHShell = Nothing
Set objWSHShell = Nothing
Set objFSO = Nothing
Set objShell = Nothing
Set objFolder = Nothing
Set objFolderItem = Nothing
Set OWS = Nothing

WSCript.Quit

 You can do better than I did in this script by closing the objects in a more "Best Practices" method. Because this is a snip I didn't rework it. Timing is important and you might need to adjust the timings to match your network equipments response times. Slow servers need more time.

This is a simple script that I made to map remote users to the FTP server after they connected via VPN. It also can map LAN NAS units and is simple for those that need things simple. Name the file FTP_LAN_MAP.vbs and modify the folder names and locations. You can use UNC instead of the FTP that I have in the script as well.