Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make logging more accurate?

Status
Not open for further replies.
Feb 11, 2005
153
US
How is it when I take the time variable it does not log the "real time" it just logs the time from the start of the script? I am trying to do logging and the fact the time only shows the start of the script helps me in no way when I have 5 lines and all show the exact same time.

E.G.

scripr body -
Code:
objFileOutput.WriteLine "-"&Date&" @ "&Time&"- '" & strComputer & "' Checking for C:\LDCLIENT\DATA\LDISCAN.CFG."
If objFSO.FileExists("\\" & strComputer & "\C$\LDCLIENT\DATA\LDISCAN.CFG") Then
objFSO.DeleteFile "\\" & strComputer & "\C$\LDCLIENT\DATA\LDISCAN.CFG"
objFileOutput.WriteLine "-"&Date&" @ "&Time&"- '" & strComputer & "' LDISCAN deleted from C:\LDCLIENT\DATA\LDISCAN.CFG."
Else
objFileOutput.WriteLine "-"&Date&" @ "&Time&"- '" & strComputer & "' No LDISCAN file at C:\LDCLIENT\DATA\LDISCAN.CFG."
End If
objFileOutput.WriteLine "-"&Date&" @ "&Time&"- '" & strComputer & "' checking for C:\LDISCAN.CFG."
If objFSO.FileExists("\\" & strComputer & "\C$\LDISCAN.CFG") Then
objFSO.DeleteFile "\\" & strComputer & "\C$\LDISCAN.CFG"
objFileOutput.WriteLine "-"&Date&" @ "&Time&"- '" & strComputer & "' LDISCAN deleted from C:\LDISCAN.CFG."
Else
objFileOutput.WriteLine "-"&Date&" @ "&Time&"- '" & strComputer & "' No LDISCAN file at C:\LDISCAN.CFG."

yields

-12/27/2006 @ 2:39:42 PM- 'ORL03LDTEST' Checking for C:\LDCLIENT\DATA\LDISCAN.CFG.
-12/27/2006 @ 2:39:42 PM- 'ORL03LDTEST' No LDISCAN file at C:\LDCLIENT\DATA\LDISCAN.CFG.
-12/27/2006 @ 2:39:42 PM- 'ORL03LDTEST' checking for C:\LDISCAN.CFG.
-12/27/2006 @ 2:39:42 PM- 'ORL03LDTEST' No LDISCAN file at C:\LDISCAN.CFG.

I know that this isn't happening in 1)the same milliscond and I also know that if I add an exe that takes 15 mins to run it still shows the same time. it still shows the same time.

Is there something in the script to make it so it captures real date/time information not just date/time from when the script starts?
 
Have you tried adding a few wscript.sleep commands in there to see if there is a change in the times displayed? If you add an exe? Do you mean execute it with wscript.shell run method? If so, are you using the wait parameter so your script waits for it to finish?

dm4ever
--------------------------------------------------------------------------------
My approach to things: K.I.S.S - Keep It Simple Stupid
 
Wsript.sleep XXX where XXX is any number (I went as high as 30000 (5 minutes) with no shcnage in time listed next to it. As well the run command is -

WshShell.Run "C:\psexec.exe \\" & strComputer & " -i C:\Temp\LD\ORLAW1~1.exe",2 , True

Which executes flawlessly and the script does indeed pause before the next line is ran but this install usually takes upward of 15 minutes yet the line right below it shows the exact same date ALL of the other.

The entirety of this script is about 20-30 minutes (depending on remote CPU processing capabilities) run time start to finish with about 20 logged items and NONE of them even show a single second off from the time Variable and I forgot to show you in the script I have set -

Time = Time()
 
Disreguard that Time = Time() this isn't in the script. I forgot I got an error upon trying it so had pulled it out.
 
NVM we would not have figured it out. This was being ran on a machine thats from a bad image and it has a ton of problems when I ran the same script on a known good PC it runs like a champ.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top