Function ExecSyncStep(stepName) Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(stepName) Dim ouputStream ouputStream = "" Do While oExec.Status = 0 Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop WScript.Sleep 100 Loop Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop Set ExecSyncStep = oExec End Function