Source language: Translate to:

Vendor ID

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby Neosoft Support » Tue Apr 13, 2010 10:13 am

Hi Sam,

There isn't anything built into NeoBook that can read a USB drive's ID or serial number. However, you might be able to do it with a VBScript function.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Read USB Device IDs

Postby Ndzn » Thu Apr 15, 2010 8:34 am

The following will output a text file listing of USB devices & IDs. You could turn this into a function file instead...

Code: Select all
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("usb_device_list.txt", ForAppending, True)

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDevices = objWMIService.ExecQuery _
   ("Select * From Win32_USBControllerDevice")

For Each objDevice in colDevices
   strDeviceName = objDevice.Dependent
   strQuotes = Chr(34)
   strDeviceName = Replace(strDeviceName, strQuotes, "")
   arrDeviceNames = Split(strDeviceName, "=")
   strDeviceName = arrDeviceNames(1)
   Set colUSBDevices = objWMIService.ExecQuery _
       ("Select * From Win32_PnPEntity Where DeviceID = '" & strDeviceName & "'")
   For Each objUSBDevice in colUSBDevices
       objTextFile.WriteLine objUSBDevice.Description
       objTextFile.WriteLine objUSBDevice.PnPDeviceID
   Next   
Next

objTextFile.Close

User avatar
Ndzn
 
Posts: 134
Joined: Sun Sep 20, 2009 8:37 am

Postby bunker » Fri Jun 04, 2010 2:34 pm

Hi this is my way of resolving this...

Español:
:arrow: http://www.neobookeros.com.ar/?p=268

English:
http://translate.google.com.ar/translat ... =&ie=UTF-8

Greetings
User avatar
bunker
 
Posts: 141
Joined: Sat Sep 29, 2007 4:00 pm

Postby TinTin » Tue Mar 22, 2011 6:51 am

This function has proved very useful I have to say, I'm using it to detect a number of devices..

On another note, would it be possible for a function to grab the hardwares ID's of a COM port?

I have a USB device, which creates a virtual COM port, and am trying to match the USB Device with it's assigned COM port by hardware ID..

I'm slowly learning the VB Scripting but any help would be appreciated...

Ideally I would just need the code from the function above to get the Hardware ID's of the installed COM ports..

Thanks all..

AJ
TinTin
 
Posts: 162
Joined: Sun Dec 06, 2009 4:03 am
Location: UK


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests