Remotely get WMI info from Security Center?

  • Thread starter Thread starter Jimmy B
  • Start date Start date
J

Jimmy B

Hi all, I have a sample script that gets this locally just fine, but when I
replace the "." with the "ComputerName", it gives me an error. ?


strComputer = "." 'Can set to remote machine.

On Error Resume Next
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\SecurityCenter")

Set colItems = oWMI.ExecQuery("Select * from AntiVirusProduct")

If Err = 0 Then
For Each objAntiVirusProduct In colItems
WScript.Echo "companyName: " & objAntiVirusProduct.companyName
WScript.Echo "displayName: " & objAntiVirusProduct.displayName
WScript.Echo "instanceGuid: " & objAntiVirusProduct.instanceGuid
WScript.Echo "onAccessScanningEnabled: " &
objAntiVirusProduct.onAccessScanningEnabled
WScript.Echo "productUptoDate: " & objAntiVirusProduct.productUptoDate
WScript.Echo "versionNumber: " & objAntiVirusProduct.versionNumber
Next
Else
Err.Clear
WScript.Echo "Unable to connect to SecurityCenter class on " & strComputer &
"."
WScript.Echo " Error Number:" & Err.Number
WScript.Echo " Source:" & Err.Source
WScript.Echo " Description:" & Err.Description
End If
 
Remove "On Error Resume Next"
and please see what error and what exactly fails?

My guess is that your remote computer which you are giving is not
configured. Please configure following the link
http://msdn2.microsoft.com/en-us/library/aa389290.aspx

Thanks,
Manbinder Pal Singh

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks! That led me to look at things more closely. I had my DCOM turned
off (for diagnostic reasons) on my local computer, so WMI wasn't working on
any of my scripts. DUH!
 
Ok Great to know that :)

Thanks,
Manbinder Pal Singh

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top