WMI is not seeing specific services on some servers
From: wren mott (wren_mott_at_hotmail.com)
Date: 10/19/04
- Next message: Dan: "Re: pass param to hta program"
- Previous message: Darius Blaszijk: "Getting filename from dialog"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Dan: "Re: pass param to hta program"
- Previous message: Darius Blaszijk: "Getting filename from dialog"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|