Thanks. Unfortunately, I don't know how to write .NET. I did find a workaround for now. I run the preview every time but then before the second run without -preview, I do a FINDSTR in the log and if it finds the phrase "Nothing to synchronize" then the script exits at that point. If it doesn't find this string, it proceeds to run the script again without -preview.