Torgeir
Thu Nov 04 14:28:15 CST 2004
Mike Minor wrote:
> Torgeir...
>
> The script you provided is exactly what I need. Thank you very much.
>
> I had a little trouble with the list of services to be checked. It stated
> that I should create a text file services.txt. When I ran the script it
> would give an error of No services found and I found that in the name of the
> array of services needed to be changed ever so slightly in the following
> line:
>
> oServer.Filter = Array("service") - to - oServer.Filter =
> Array("services")
>
Array("service") works for me, Array("services") does not,
this on a Win2k SP2 computer.
This works for me:
'--------------------8<----------------------
Set oWshNet = CreateObject("WScript.Network")
sServer = oWshNet.ComputerName
Set oServer = GetObject("WinNT://" & sServer)
oServer.Filter = Array("service")
For Each oService in oServer
WScript.Echo oService.Name
Next
'--------------------8<----------------------
Ahh, testing on a WinXP SP2 computer, bot "service" and
"services" work.
> When running the script however, I am receiving a Syntax error in line 78,
> character 5.
>
> I believe that the line of code that is erroring off is the "Set
> oServer...." line listed below, but I can't seem to detect the syntax
> problem:
>
> For Each sServer In aServers
> LogStatus Now & " ---- Starting " & sServer & " ----"
>
> ' test with ping
> If IsConnectible(sServer,"","") Then
> Set oServer = GetObject("WinNT://" & sServer)
> oServer.Filter = Array("services")
>
> Can you identify the syntax error?
Not really, if I run the script that was attached to your other
post that was ending up as separate thread, I have no errors,
and results are written to the StatusServices.txt file.
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx