As I wrote in a previous post, I began using the new DFS Replication database cloning technique to speed up initial sync. Thanks to Ned Pyle’s great How-To on the subject, I was able to tell exactly which events to look for in the event log to get an idea of progress: 2412 for the start of the process, 2416 for progress, 2404 for successful finish, and 2418 for an unsuccessful end (found that one out on my own, whoops!).
Since I clearly had a few hours to kill while the import happened, I wrote up a quick script to show the progress, with estimated time remaining.
This is a quick-and-dirty powershell script with no fancy CmdletBinding or any parameters at all, and no comments, and barely any testing so use at your own risk, etc.
The basic idea is that it keeps checking the event log (I’m doing it every 5 seconds), looking for new progress events, and it uses Write-Progress to display some pretty stats. When the event 2404 indicates a successful completion or 2418 indicates an error, it should end the script or raise an exception, respectively.
In the meantime, you’ll just see the progress:
The progress bar is only updated when a new event is logged, so you won’t see continuously changing numbers. It’s more of a thing you leave running in the background and check on every now and then.
Oh and it doesn’t have to be run on the machine doing the import, so it can be run from a management server or desktop client to keep tabs on the progress. Since it uses events in the event log on the destination computer, stopping and restarting the script will still give you consistent progress.