Re: Service sort in VBscript



Oh nevermind.
I just changed Win32_ApplicationService to Win32_Service and it works
just fine!

Thank you very much!


mishkare@xxxxxxxxx wrote:
This works great on my XP workstation but when I try it on a 2003
server I get an error in line 6
...For Each obj_Service in obj_Services

Any ideas?


Its me Earnest T. wrote:
Dim str_Services
Dim obj_WMI, obj_Services, obj_Service
Set obj_WMI = GetObject("winmgmts:\\.\root\cimv2")
Set obj_Services = obj_WMI.ExecQuery("Select * from
Win32_ApplicationService WHERE Name LIKE '%" & "GECS" & "%'",,48)

For Each obj_Service in obj_Services
str_Services = str_Services & obj_Service.Name & ", " &
obj_Service.Description & vbcrlf
Next

msgBox str_Services

Bryan Martin

<mishkare@xxxxxxxxx> wrote in message
news:1162029583.616805.83560@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am trying to write a script to examine all the services on a machine
and return only the services that contain "GECS" in the name and I am
having trouble understanding how the For ...each statement could be
used for this.

I have seen a lot of examples that will list all the services or 1
named service.
But, I can't do anything like this with out an error

...For Each objItem in colItems
If instr(objitem,"GECS") then ...

I appreciate the help.


.



Relevant Pages

  • Re: Getting directory listings from a client machine
    ... >will work or just look for the directory on the server. ... >Dim strPath 'Path of directory to show ... >Dim objItem 'Variable used to loop through the folder contents ... >Set objFolder = objFSO.GetFolder ...
    (microsoft.public.inetserver.asp.general)
  • Re: named problem
    ... My named service when some domain is not available for small time ... does not resolve it again until I restart it (it is some thing ... To reduce network traffic and increase performance the server ... max-ncache-ttl is used to set a maximum ...
    (Fedora)
  • Re: Create email
    ... Nevermind, I do all of my email stuff directly on the server. ... outlook in so long, I forgot that I hadn't set it up the last time I ... Does anyone know of any articles that can help with this? ...
    (microsoft.public.vc.mfc)
  • Re: Frustrated :(
    ... > nevermind, I got it....the proc cache is not persistent, it goes away when ... SQL Server invalidates plans after a certain amount of data has been modified ...
    (microsoft.public.sqlserver.security)
  • Re: Very slow performance on an intranet
    ... Oops... ... nevermind. ... After six hours thinking this was a server issue, ... Coinciding System error is: ...
    (microsoft.public.windows.server.networking)

Quantcast