WMI is not seeing specific services on some servers

From: wren mott (wren_mott_at_hotmail.com)
Date: 10/19/04


Date: 19 Oct 2004 16:25:33 -0700

All -

This is puzzling. I have written a script that will ping a subnet,
and taking those IP addresses that give a response, will then connect
to the WMI service on each IP address and query for a specific set of
services to make sure they're installed. In this case I am looking
for AntiVirus and PAtchlink services.

The script runs well; however, on a few servers, even though both
services are present, WMI reports PatchLink as missing. What's more
puzzling is that this always happens on the same servers and WMI
correctly reports that the AntiVirus service is installed.

The code searches for the services by querying the Win32_Service.Name
property.

Has anyone seen anything like this, or can anyone suggest a hypothesis
why this may be occuring. The goal here is to have a script that can
verify what the GUI tools (Symantec and PatchLink) are telling us
which have on occasion proved to be inaccurate.

ALthough I don't believe there is anything wrong with the script
itself, I have included it below.

Thanks for any input!!!

Wren Mott

***SCRIPT***

On Error Resume Next

 WScript.Echo "IPAdress" & "," & "HostName" & "," & "SAV" & "," &
"Patchlink"
 Dim x, strIP, varSubNet
 
 varSubNet = "172.18.2."

'Set starting octet
 x=76

Do Until x = 254

strIP = varSubNet & x
    Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
        ExecQuery("select * from Win32_PingStatus where address = '" &
strIP & "'")
    For Each objStatus in objPing
        If objStatus.StatusCode = 0 Then
            strText = (strIP & ",")
            
'Remotely Connect to WMI
              Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strIP &
"\root\cimv2")
              
'Check for problems connecting to WMI
              If Err.Number <> 0 Then
              WScript.Echo Err.Description
              Err.Clear
               End IF

'Query for Host Name
                Set colComputerSystems = objWMIService.ExecQuery("Select * from
Win32_ComputerSYstem")
                For Each ComputerSystem In colCOmputerSystems
             strText = strText & ComputerSystem.Name & ","
                Next
                
'Query for SAV
                Set colServices = objWMISErvice.ExecQuery("Select * from
Win32_Service")
                For Each SAVservice In colServices
                If SAVservice.name = "Symantec AntiVirus" Then
                        strText = strText & "installed,"
                ' Else strTExt = strText & "not installed,"
                End IF
                Next
                
'Query for Patchlink
                Set colServices = objWMISErvice.ExecQuery("Select * from
Win32_Service")
                For Each PLservice In colServices
                If PLservice.name = "PatchLink Update" Then
                        strText = strText & "installed,"
                ' Else strTExt = strText & "not installed,"
                End IF
                Next
             
        End If
    Next
x = x+1

IF strText <> "" Then
WScript.Echo strText
Else WScript.Echo strIP & ", is unreachable by PING."
End If

strText = ""
Loop

End Sub



Relevant Pages

  • WMI sees services correctly on most servers but not all...
    ... The script runs well; however, on a few servers, even though both ... WMI reports PatchLink as missing. ... Dim x, strIP, varSubNet ...
    (microsoft.public.win32.programmer.wmi)
  • RE: Does WMI have to be installed on Remote Computer?
    ... IMHO this looks like a well constructed and very vell commented script. ... WMI comes as standard on w2k w2k3 and xp, ... does WMI need to be installed on the remote computer in order for a ... ''' First try to ping the server. ...
    (microsoft.public.scripting.vbscript)
  • Re: Look over this script.....could anything be done better?
    ... will be unable to connect with WMI. ... With this version of the script I have kept that included because the script that enumerates all of the servers has some servers that no longer exist. ... Dim objWMIService, colFixedDrives, objFD ...
    (microsoft.public.scripting.vbscript)
  • Re: Create simple file share on the fly
    ... WMI share routine faithfully works. ... You can place the command line below as the final line in your WMI ... You might experiment with actual workstations to see if the script is ... the shares that I make from the Windows GUI, ...
    (microsoft.public.windowsxp.security_admin)
  • RE: Starting Excel and doing "stuff"...
    ... I have a WMI .vbs that monitors a folder for new files. ... This code first creates an event filter that polls the repository every 5 ... can use another script or utilities like wbemtest.exe or CIM Studio). ... Active script event consumer has limitations, you can't make Excel visible, ...
    (microsoft.public.excel.programming)

Loading