vbscript - VB Script get services remote machine not always providing array -


using following vb script code on variey of windows os:

dim objcomputer dim computername, computerstr dim rs, objcmd, cobj 'dim olog, ofso, svccnt dim arg1, args  set args = wscript.arguments arg1 = args(0) wscript.echo arg1 computerstr = "winnt://" & arg1 set objcomputer = getobject(computerstr) objcomputer.filter = array("service") each aservice in objcomputer wscript.echo aservice.name       if  aservice.name = "mssqlserver"         if aservice.status = 4           wscript.echo "running"         else           wscript.echo "not running"         end if        end if     next 

this works fine on every server (45) one. returns array of services , doesn't. succeeds couple of times , fails 15 minutes.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -