What 'control flow task' can be used to run a OS command quickly?

  • I need to use 'net use' to map a network drive as a step in the SSIS package, before I can copy the file to the mapped network drive.

    Is there any easy way to do this? Will the 'Execute Process Task' help? Or do I need to write VBscript in order to use 'Script Task' for this purpose. I am not very good at writing VBscript.

    Thanks for any help!

  • Why not just use a straight UNC path?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • I would like to use UNC path, but the 'File System Task' does not allow me put UNC path. It may because that the source server is not in the same domain as the destination server.

  • Really - OK, use a Script Task.

    Here's some code:

    Public Sub Main()

    '

    ' Add your code here

    '

    Dim FileToCopy As String

    Dim NewCopy As String

    FileToCopy = "C:\temp\test.txt"

    NewCopy = "C:\temp\NewTest.txt"

    If System.IO.File.Exists(FileToCopy) = True Then

    System.IO.File.Copy(FileToCopy, NewCopy)

    End If

    Dts.TaskResult = ScriptResults.Success

    End Sub

    Replace the whole of the default Public Sub Main / End Sub block with the code above.

    Then modify the two lines FileToCopy = and NewCopy = to contain source and destination UNC.

    Should then be good to go.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Thanks for the solution!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply