vbscript - VBS check for the output of netstat -
i created check:
' check if windows or mac if not objfso.folderexists("\\client\c$\.") wscript.quit end if
that check see if windows system or not. if windows machine run script if not want exit. need check make sure both conditions true not sure how. there output using netstat command. under local address there address has port 1494 machine name of cag.domain.com. how can include check both parts must true run script if not script closes. if \client\c$. = true , local address :1494 , foreign address = cag.domain.com = false script not run.
i'm not @ windows machine can't give right parameters netstat nor correct regex pattern check output of netstat
i'd along lines of:
dim wshshell, oexec set wshshell = createobject("wscript.shell") set myregexp = new regexp myregexp.ignorecase = true myregexp.global = true myregexp.pattern = ":1497[ ]cag[.]domain[.]com" set oexec = wshshell.exec("netstat -a") 'wait end of process (busy wait, yuck!) while oexec.status = 0 wscript.sleep 100 loop 'scan command output flow dim omatchcoll, gotnetstat gotmatch = false while oexec.stdout.atendofstream <> true omatchcoll = myregexp.execute(oexec.stdout.readline) if omatchcoll.count > 0 gotnetstat = true exit end if loop
read more:
Comments
Post a Comment