Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to map the network drive, here's an example that I'm using now:</p> <pre><code> profile = "false" landingPadDir = Dts.Variables("strLandingPadDir").Value.ToString resultsDir = Dts.Variables("strResultsDir").Value.ToString user = Dts.Variables("strUserName").Value.ToString pass = Dts.Variables("strPassword").Value.ToString driveLetter = Dts.Variables("strDriveLetter").Value.ToString objNetwork = CreateObject("WScript.Network") CheckDrive = objNetwork.EnumNetworkDrives() If CheckDrive.Count &gt; 0 Then For intcount = 0 To CheckDrive.Count - 1 Step 2 'if drive is already mapped, then disconnect it If CheckDrive.Item(intcount) = driveLetter Then objNetwork.RemoveNetworkDrive(driveLetter) End If Next End If objNetwork.MapNetworkDrive(driveLetter, landingPadDir, profile, user, pass) </code></pre> <p>From There just use that driveLetter and access the file via the mapped drive.</p> <p>I'm having one issue (which led me here) with a new script that accesses two share drives and performs some copy/move operations between the drives and I get an error from SSIS that says:</p> <pre><code>This network connection has files open or requests pending. at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn) at ScriptTask_3c0c366598174ec2b6a217c43470f581.ScriptMain.Main() </code></pre> <p>This is only on the "2nd run" of the process and if I run it a 3rd time it all works fine so I'm guessing the connection isn't being properly closed or it is not waiting for the copy/move to complete before moving forward or some such, but I'm unable to find a "close" or "flush" command that prevents this error. If you have any solution, please let me know, but the above code should work for getting the drive mapped using your alternate credentials and allow you to access that share.</p> <p>Zach</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload