none
Need help automating robocopy with powershell. RRS feed

  • Question

  • I routinely copy a lot of files between different servers via robocopy, and I was wondering if there is a better way to create and monitor the copy jobs.
    What I currently do is manually create a batch file (see example below), and then run it in the console session of the server via RDP.
    This lets me logon periodically and check how the copies are going.
    (We're talking an average of 50-100 CMD windows and terabytes of files, so it takes quite a while)

    Is there an easy way to:

    1.  Automate building the batch file or creating an equivalent powershell script?
        (The robocopy needs to run from the destination server, in a session that is not affected by
         anyone looging onto the server, and there can be more than 100 shares that need to be
         copied, but I try to limit the number of concurrent sessions to 100 or less for performance)

    2.  Monitor the progress of the operation?
        (Overall percentage complete would be great, but even seeing something like "23 of 84 sessions
         complete" would be helpful.)




    start cmd.exe /c robocopy \\server1\$drivename\sharename\sharename1 drivename\sharename\sharename1 <lots of robocopy parameters go here>
    start cmd.exe /c robocopy \\server1\$drivename\sharename\sharename2 drivename\sharename\sharename2 <lots of robocopy parameters go here>
    etc...........
    etc...........
    Sunday, July 5, 2009 7:44 PM

Answers

All replies

  • Hi TVDood,

    Robocopy's '/log' parameter lets you specify a log file, and I recommend combining it with '/np' so that the log file isn't combined with the percentage copied for each file. Aside from this, I wonder if there isn't a more efficient way of copying the data, such as by using the OS built-in replication feature?

    Bill
    Monday, July 6, 2009 2:55 PM
    Moderator
  • I'm already using the logging and the /np parameter in robocopy so I can see what happened after it is done, but since some of the copy's can literally take days to complete, it would be nice to have a way to check progress.

    These copies are done for DFS pre-staging, so that I can use replication.
    Monday, July 6, 2009 11:03 PM
  • Perhaps RichCopy would be a better fit

    http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx?pr=blog
    Brandon Shell [MVP]
    • Marked as answer by IamMred Saturday, January 9, 2010 1:47 AM
    Tuesday, July 7, 2009 1:12 PM
    Moderator