# How to connect Mapped netwrok drive in uipath

Hello Team,
I need to connect to the network drive before moving file onto network drive .

Regards
Raj kumar

Try this
Move files by mapping a network drive
On the Start menu, click My Computer .

On the Tools menu, click Map Network Drive .

In Drive , select a drive letter.

In Folder , type the name of the Web server and documentlibrary in the form \ Server_Name \ Document_Library .

The mapped network drive opens in Windows Explorer toshow the contents of the document library.

Open a Windows Explorer window, and then find the folder withthe files that you want to copy to the document library.

Select the files you want, and then drag them into the documentlibrary in the mapped network drive.

Network drive is already mapped and we are using move file with network path its is working fine , but some time it throws exception stating that mapped drive is not connected , so do we have any way to check connectivity of network drive , if it is disconnected and than connect and move file using move file activity

1 Like

Hi,

You can check this by using “dir.Exists(“z:”)” command in a If Activity.
dir is a variable with System.IO.Directory type.

1 Like

Sorry for bother you.

Did you resolve this issue? I’m having the same problem

I don’t recommend using mapped drives with automation. They are essentially just a representation of the actual network location.

If you can get the full path to the location you want to access, test access by typing this location in Windows Explorer:

Then, just use that path as your path rather than using a mapped drive letter.

If you really need to automate drive mapping then I suggest calling a commandline script, but you shouldn’t need to unless there is a really old application that requires it.

Regards.

3 Likes

I second clayton’s suggestion. We have had some issues where a mapped drive letter was needed, so in those rare instances we use a powershell script to map it. However, you should always use the full path rather than the drive letter whenever possible

Connect_Map_Network_Drive.xaml (18.2 KB)
Hi, Please try with this code.

I just call a vbscript code that maps the drive and at the end of the process call vbscript to disconnect the mapped drive. When you call the vbs activity from activities panel be sure to include the directory you want to map and the drive letter and arguments.

map Drive.vbs
Dim objNetwork, strRemoteShare, strDriveLetter
if WScript.Arguments.Count = 0 then
WScript.Echo “Missing parameters”
else
WScript.Echo “Input path provided”
Set objNetwork = WScript.CreateObject(“WScript.Network”)
strRemoteShare = WScript.Arguments(0)
strDriveLetter = WScript.Arguments(1)
objNetwork.MapNetworkDrive strDriveLetter, strRemoteShare, False
end if
strDriveLetter = nothing
strRemoteShare = nothing
objNetwork = nothing

DisconnectMapdrive.vbs
Dim objNetwork
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.RemoveNetworkDrive WScript.Arguements(0)
objNetwork = nothing

Could you share your xaml ?

Tks