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
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