Suche nach USB drive letter mit VBScript

Fand ich dieses Skript auf http://network-blog.lan-secure.com/2008/03/usb-detection-using-wmi-script.html

 strComputer = "." '(Any computer name or address)
 Set wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 Set wmiEvent = wmi.ExecNotificationQuery("select * from __InstanceOperationEvent within 1 where TargetInstance ISA 'Win32_PnPEntity' and TargetInstance.Description='USB Mass Storage Device'")
 While True
 Set usb = wmiEvent.NextEvent()
 Select Case usb.Path_.Class
 Case "__InstanceCreationEvent" WScript.Echo("USB device found")
 Case "__InstanceDeletionEvent" WScript.Echo("USB device removed")
 Case "__InstanceModificationEvent" WScript.Echo("USB device modified")
 End Select
 Wend

Dieses Skript ist neben dem, was ich brauche. Es erkennt die Einfügung von einem usb-Laufwerk. Wie es zu ändern finden Sie die Laufwerksbuchstaben des usb-Laufwerks? Wenn ich den Laufwerksbuchstaben, dann auf einfügen anstelle von echo "USB-Gerät gefunden" ich werde in der Lage sein zu laufen command line scanner von Avast Antivirus automatisch Scannen Sie das Laufwerk nach dem Einlegen. Bitte Anleitung!

InformationsquelleAutor Dario Dias | 2011-11-26
Schreibe einen Kommentar