Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1112185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:40:08+00:00 2026-05-17T02:40:08+00:00

I need to robocopy files from one location to another in a SSIS package.

  • 0

I need to robocopy files from one location to another in a SSIS package. Since the folder is on another domain, I need to impersonate another account before I run the robocopy.exe command. I found I can execute a “net use” command to impersonate the necessary user account and then execute the robocopy command immediately afterwards. I don’t see any way to do this in an Execute Process command to do this directly, so I use an Execute Process task to run a batch file that has these two commands as separate lines. The downside of this approach is that I cannot read the results of the Execute Process command. So this leads me to three questions:

  1. Is there a way to execute a multi-line command in a single Execute Process task?
  2. Is there a way to execute robocopy.exe while impersonating another account in one line?
  3. Is there a way to write the results of a batch file back to either a variable in SSIS or to the SSIS database log?

If there is a positive answer for any of the above three questions, then I may be able to work out a way to add job success or failure rules based on the results of the robocopy command.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:40:09+00:00Added an answer on May 17, 2026 at 2:40 am

    This can easily be achived if you have enabled the use of the Extended Stored Procedure “xp_cmdshell” (see Books Online for “Surface Area Configuration”).

    In the following sample I have build a .CMD file containing all my ROBOCOPY options and simple executes this command file using xp_cmdshell grabbing the output to a table variable (can be a persistent table instead):

    Just add a Execute T-SQL statement Task to your SSIS package with the following statement:

    /** START **/
    
    DECLARE @cmdfile nvarchar(255) = N'C:\myFolder\myCommandFile.cmd'
    DECLARE @logtable table (
        [RowId] integer IDENTITY(1,1) NOT NULL
        ,[Message] nvarchar(1024) NULL
    )
    
    INSERT INTO @logtable ([Message])
    EXEC xp_cmdshell @cmdfile
    
    SELECT *
    FROM @logtable
    WHERE
    [Message] IS NOT NULL
    
    /** END **/
    

    Depending on your logging options set for the ROBOCOPY command you can show progress, headers, report or more. See the ROBOCOPY documentation for those options. Also try use the /TEE switch if to grab any console output from the ROBOCOPY command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to copy a particular file from one location to another., Is it
I need to a way to update all files in a destination folder and
Need advise I am currently using CRM4.0 webservice to create account from reading my
need a little help with this one. I have a form that I am
Need a way to navigate/browse XSLT files easily with Vim. Similar to the way
Need a GUI with many tabs (TabBarController and UITabBar) and one fullscreen view, e.g.
need your help with PHP templating. I'm new to PHP (I'm coming from Perl+Embperl).
Need quick help from win developers. Please correct me where I got it wrong.
I need to copy multiple files in a single batch file. The files have
Need something simulat jcrop plucgin (link to example is here: http://publikz.com/one-more-task-rounded-selection-in-jquery/ ) but with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.