About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Troubleshooting
Problem
The script below will map a network drive.
Resolving The Problem
In order to execute below script You will need to know two things:
1. What the next drive letter map will be (drive_letter = "S")
2. The actual UNC path to the drive and folder ("\\Servername\Folder")
Requirements:
Internet Explorer 4.0 or greater, latest Microsoft Windows Service Packs and/or updates depending on Windows platform being used.
>>>>>>>>>>>>>>>>>>>>>
Option Explicit
Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Sub Main
Dim drive_letter As String
Dim share_name As String
Dim password As String
drive_letter = "S"
If InStr(drive_letter, ":") = 0 Then
drive_letter = drive_letter & ":"
share_name = \\ServerName\FolderName
password = "password"
If WNetAddConnection(share_name, password, drive_letter) > 0 Then
MsgBox "Error mapping drive"
Else
MsgBox "Drive successfully mapped"
End If
End If
End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2001a;2001a.04.00;2002;2002.05.00;2002 Release 2;2002.05.20;2003;2003.06.00;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Was this topic helpful?
Document Information
More support for:
Rational Robot
Software version:
2001a, 2001a.04.00, 2002, 2002.05.00, 2002 Release 2, 2002.05.20, 2003, 2003.06.00, 2003.06.12, 2003.06.13
Operating system(s):
Windows
Document number:
81583
Modified date:
16 June 2018
UID
swg21194551