Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: hundreth second millisecond time remote system machine computer network server
One suggestion is to use the Windows command w32tm. A tool used to diagnose problems occurring with Windows Time. You can get the ouptu directly into Winbatch using the following:
#DefineFunction CaptureDosOutput(DosCommand) DataArray=ArrDimension(3) ;Allocate return array ArrInitialize(DataArray,"") ;initialize to all null strings oShell = ObjectOpen("WScript.Shell") ;open shell object oScriptExec = oShell.Exec(DosCommand) ;run the command ;Open output objects oStdOut = oScriptExec.StdOut oStdErr = oScriptExec.StdErr While (oScriptExec.Status==0) ;wait for completion ;Caputure StdOut data oStdOut = oScriptExec.StdOut While ! oStdOut.AtEndOfStream strLine = oStdOut.ReadLine DataArray[1] = StrCat(DataArray[1],strLine,@CRLF) EndWhile ;Capture StdErr data oStdErr = oScriptExec.StdErr While ! oStdErr.AtEndOfStream strLine = oStdErr.ReadLine DataArray[2] = StrCat(DataArray[2],strLine,@CRLF) EndWhile TimeDelay(0.1) EndWhile ;Get remainder of data, if any ;Caputure StdOut data oStdOut = oScriptExec.StdOut While ! oStdOut.AtEndOfStream strLine = oStdOut.ReadLine DataArray[1] = StrCat(DataArray[1],strLine,@CRLF) EndWhile ;Capture StdErr data oStdErr = oScriptExec.StdErr While ! oStdErr.AtEndOfStream strLine = oStdErr.ReadLine DataArray[2] = StrCat(DataArray[2],strLine,@CRLF) EndWhile DataArray[0]=oScriptExec.ExitCode ;save errorlevel/exit code ;Close handles that were opened ObjectClose(oStdOut) ObjectClose(oStdErr) ObjectClose(oScriptExec) ObjectClose(oShell) ;Return the array Return(DataArray) #EndFunction AddExtender("WWWNT34i.DLL") BoxOpen("Scanning Computer", "Preparing for Scan") ;;; This section gets a list of all computers currently seen on the network Computers = wntServerList("","",4096) masterlist = ItemSort(Computers,@TAB) ComputerCount = ItemCount(Masterlist, @TAB) LastError( ) ;; This sets the error memory to zero output = "" For a = 1 To Computercount ExtractComp = ItemExtract(a, Masterlist, @TAB) report=StrCat("Scanning Computer: ",ExtractComp," ",a," of ",Computercount) BoxTitle(report) ExtractComp=StrSub (ExtractComp, "3", 99) BoxText(StrCat("Scanning computer"," ",ExtractComp)) cmd = StrCat("w32tm /stripchart /computer:",ExtractComp," /samples:1 /dataonly") outarray = CaptureDosOutput(cmd) If output == "" Then output = ExtractComp:@LF:outarray[1] Else output = output:@CRLF:ExtractComp:@LF:outarray[1] Next Pause('Results',output) BoxShut() Exit
Article ID: W18301
Filename: Highly Accurate Time From Network Computer.txt
File Created: 2014:07:18:09:51:40
Last Updated: 2014:07:18:09:51:40