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 #### #Returns the status object of the sync process $oExec; $oExec = system($stepName); $ouputStream = ""; while($? eq 0){ Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop sleep 100; } Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop #WScript.StdOut.Write ouputStream return $oExec; }