This doesn´t work, if i parse this i get an error in the second line of the parsed part at the end of the script.
wbemErrInvalidClass - class does not exist on this system. (Win32_USBDevice)
C:\Dokumente und Einstellungen\username\Desktop\audit_windows-v10.v
bs(6426,
SWbemObjectSet: Unbekannter Fehler
[quote="jpa"]I [url=http://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=5924#p20758]helped someone earlier[/url] with a problem around the Printer stuff. I don't see any problem myself so it's hard to test.
One thing I noticed was the code tries to check for errors:
[code]on error resume next
Set colItems2 = objWMIService.ExecQuery("Select * FROM Win32_USBDevice where Caption = '" & objItem.DriverName & "'",,32)
error_returned = Err.Number : if (error_returned <> 0 and debugging > "0") then wscript.echo check_wbem_error(error_returned) & " (Win32_USBDevice)" : audit_wmi_fails = audit_wmi_fails & "Win32_USBDevice " : end if
on error goto 0
if IsEmpty(colItems2) then[/code]
But if there is some error and colItems2 isn't valid the IsEmpty test doesn't work because it's always false. Then we try and iterate over the bad colItems2 and have a problem. I tried to get this fixed earlier but didn't get it tested.
Instead of IsEmtpy(colItems2) use IsCollectionEmpty(colItems2) and add this function at the end of the audit script:
[code]Function IsCollectionEmpty( in_collection )
If TypeName( in_collection ) <> "Nothing" Then
If in_collection.Count > 0 Then
IsCollectionEmpty = false
Else
IsCollectionEmpty = true
End If
Else
IsCollectionEmpty = true
End If
End Function[/code]