Paul
Mon Jan 29 10:59:52 CST 2007
"Eric Wu" <wugh@ms21.hinet.net> wrote in message
news:OLlsnH0QHHA.1200@TK2MSFTNGP04.phx.gbl...
> Hi All,
> I have two questions. First, we wrote a script to monitor file server
> response time. But datediff() function can only calculate time difference
> in
> seconds. We are asked to provide data in mini-second. Is this possible in
> VBScript? Or, i have to use vb.net?
> 2nd question, we wrote a script to list file service connection
> information on a fie server, then try to check virus defination file on
> connected client using WMI. But some of this client is not in our domain.
> When this occurs, the script tale very long time to retry. Is is possible
> to
> set a timeout value before create a wmi connection?
> Thank you very much for your time and any help.
>
> Eric Wu
>
Hi,
I can't help with your second question.
On the timer question, plain VBScript does not have a way to access time
with less than 1 second resolution. The windows OS has timers with very
high resolution, but VBScript cannot directly get to them. There are free
COM objects that can access a higher resolution timer. One, called ASPTime,
is avalable here:
http://www.cs.niu.edu/%7Ez951259/comlinks.html.
The Windows timer used by ASPTime has a variable resolution. On NT-type
systems ( for example, W2K & newer), it defaults to 10 milliseconds, but can
be as high as 1 millisecond, depending on the highest resolution currently
being used by any running application. So the trick is to guarantee its
being at 1 millisecond by running some little application, like running a
tiny HTML file with just this in the body:
<body>
<bgsound src="ding.wav" loop=0>
</body>
The 'ding' lasts under a second, but until you close this HTML file, the
sound software's request for 1 millisecond resolution remains in effect, so
ASPTime can get this resolution.
-Paul Randall