Check service of remote systems
Hi...
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...
TIA
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...
TIA
0 Comments
[ + ] Show comments
Answers (6)
Please log in to answer
Posted by:
anonymous_9363
15 years ago
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....
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....
Posted by:
mqs
15 years ago
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
Next
For Each objService2 in colListOfServices2
Next
if objService1 <> null or objService2 <> null then
Objfound.writeline strComputer & ","
msgbox "service found"
end if
loop
WScript.Quit
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
Next
For Each objService2 in colListOfServices2
Next
if objService1 <> null or objService2 <> null then
Objfound.writeline strComputer & ","
msgbox "service found"
end if
loop
WScript.Quit
Posted by:
anonymous_9363
15 years ago
Posted by:
pgiesbergen
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.