Need help...

A VB Script (Run from the server) to check two services on all the workstations listed at ComputerName.txt.
If found, then the computer name is written at foundService.txt.

Can some one pls help me...

0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


What have you tried thus far? Where is your script failing?
Answered 06/03/2009 by: jcarri06
Senior Purple Belt

Please log in to comment
I have a code to check the service locally but not remote....
Answered 06/03/2009 by: mqs
Senior Yellow Belt

Please log in to comment
Let me guess...it pipes the output of NET START to a text file and then uses FIND?

What you want, done properly, is NOT a trivial task. A properly-built script would, for example, ping the machines listed in Computername.TXT (having checked that that file exists, of course...) It's certainly not something I'd do for free. If you're willing to pay, PM me. Meanwhile, a hint: WMI....
Answered 06/03/2009 by: VBScab
Red Belt

Please log in to comment
thx for that hint....

Am i missing something here.....in the code... it wont work though

Option Explicit
Dim objWMIService, objItem, objService1, objService2, objFSO, objserverlist
Dim colListOfServices1, colListOfServices2, strComputer, strService1, strService2, intSleep
Dim objfound, objnotfound, service1, service2
intSleep = 15000
'WScript.Echo " Click OK, then wait " & intSleep & " milliseconds"
'On Error Resume Next

strService1 = " 'WOW.EXE' "
strService2 = " 'NTVDM.EXE' "

set objFSO = CreateObject("Scripting.FileSystemObject")
Set objserverlist= objFSO.OpenTextFile("servers.txt", 1)
Set objfound= objFSO.createTextFile("found.txt", 2)
'Set objnotfound= objFSO.createTextFile("notfound.csv", 2)

Do until objserverlist.atendofstream
strComputer = objserverlist.ReadLine
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
colListOfServices1 = null
colListOfServices2 = null
Set colListOfServices1 = objWMIService.ExecQuery("Select * from Win32_Service Where Name ="& strService1 & " ")
Set colListOfServices2 = objWMIService.ExecQuery("Select * from Win32_Service Where Name ="& strService2 & " ")

For Each objService1 in colListOfServices1

For Each objService2 in colListOfServices2

if objService1 <> null or objService2 <> null then
Objfound.writeline strComputer & ","
msgbox "service found"
end if


Answered 06/04/2009 by: mqs
Senior Yellow Belt

Please log in to comment
it wont work though Could you a little more vague?

Which of the 36 lines "won't work"?

Use the CODE tag for posting code. It can be accessed using the button marked '<%'.
Answered 06/04/2009 by: VBScab
Red Belt

Please log in to comment
It wont work because those two are not services but processes. And your usage of the two for loops will not help you either. Set a variable inside it and check if it is set afterwards.
Answered 06/04/2009 by: pgiesbergen
Orange Belt

Please log in to comment
Answer this question or Comment on this question for clarity