Working with Network Drives
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Select Topics in Script Programming > Working with Network Drives |
Script access to network shares and mapped drives is limited by the Windows account used to launched Robo-FTP.
Accessing Network Resources from Service Scripts
When Robo-FTP runs as a Windows service it uses the built-in Local System account by default. This account does not have access to the network. Although a Robo-FTP service may be configured to use an Active Directory account that has network permissions, services do not run in a user login session so previously mapped letter drives are not available. Therefore, scripts designed to run as a Windows service should use either UNC paths to access network resources or attempt to re-map the drive.
Accessing Network Resources from Windows Scheduled Tasks
When Robo-FTP is launched by a Scheduled Task network access is controlled by the user account specified in the Task configuration. Mapped network drives exist only in user login sessions so any Task that launches a Robo-FTP script that uses a mapped drive should have the "run only when user is logged on" option selected. Modify the script to either access the network via UNC paths or re-map the drive when a Task must run when no users are logged on.
Accessing Password-Protected Network Shares with UNC Paths
UNC paths (e.g. "\\server\path\to\file" ) can be used directly by Robo-FTP script commands. However, password-protected network shares require some additional consideration. Files within such shares can be accessed by using the WORKINGDIR command with /user and /password switches:
WORKINGDIR "\\my-host\share-name\subdir" /user=myusername /pw=mypassword
DOSCMD and Mapped Drives
There are some cases where referencing a letter drive is preferable to a UNC path. For example, if you are using the DOSCMD command to run certain shell commands then you might need to map a letter drive because some DOS commands do not work with UNC paths. To map a letter drive, use the EXEC script command to run the Windows 'net' command. For example, to mount a network drive, say drive G, issue a command such as:
EXEC "net use G: \\server\path"
If you need to submit a user name and password to connect to the network share, the command might look something like this:
EXEC "net use G: \\server\path mypassword /user:mydomain\myusername"
Warning: Mapped drives may not be available when Robo-FTP is launched as a Windows Service or Scheduled Task (see above).
Network Problems running an Existing Script on a Different Computer
Windows account permissions are usually to blame if your Robo-FTP command script is not able to access a network share when run from another machine. To troubleshoot this problem, log in to the new computer and verify that you are actually able to browse to the desired network resource using the Windows Explorer. If you are able to access the share via its UNC path it is likely that Robo-FTP is being launched by an account with insufficient permissions to access that share.
Related command(s): EXEC
See also: Scheduling File Transfers With Robo-FTP, Service Installer, Enterprise Dashboard