cscript - Invalid procedure call or argument when running a vbs file

Posted by quanta on Server Fault See other posts from Server Fault or by quanta
Published on 2011-11-18T08:18:27Z Indexed on 2011/11/18 9:55 UTC
Read the original article Hit count: 953

I've been trying to use check_time.vbs to check the Windows time.

Here's the script: http://pastebin.com/NfUrCAqU

The help message could be display:

C:\Program Files\NSClient++\scripts>cscript //NoLogo check_time.vbs /?
check_time.vbs V1.01
Usage: cscript /NoLogo check_time.vbs serverlist warn crit [biggest]

Options:
 serverlist (required): one or more server names, coma-separated
 warn  (required): warning offset in seconds, can be partial
 crit  (required): critical offset in seconds, can be partial
 biggest (optional): if multiple servers, else use default least offset

Example:
cscript /NoLogo check_time.vbs myserver1,myserver2 0.4 5 biggest

But I get the following error when running:

C:\Program Files\NSClient++\scripts>cscript //NoLogo check_time.vbs 0.asia.pool.ntp.org 20 50
C:\Program Files\NSClient++\scripts\check_time.vbs(53, 1) Microsoft VBScript run
time error: Invalid procedure call or argument

The screenshot:

enter image description here

Manually execute w32tm still works fine:

enter image description here

What might be the cause of this?

© Server Fault or respective owner

Related posts about windows-server-2003

Related posts about nagios