#92139 - 2003-06-12 01:43 AM
Re: Detecting USB/Parallel port devices
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
try driveenum() UDF and look for removable drives.
|
|
Top
|
|
|
|
#92141 - 2003-06-12 03:47 PM
Re: Detecting USB/Parallel port devices
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
but neither one is pretty...
|
|
Top
|
|
|
|
#92145 - 2003-06-12 04:49 PM
Re: Detecting USB/Parallel port devices
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I don't know if the WMI enumerator can handle wildcards in the 'sql statement' but you can try:
$myArray = WMIQuery("PNPDeviceID","Win32_PnPEntity",,"Description","*USB*") [ 12. June 2003, 16:50: Message edited by: Radimus ]
|
|
Top
|
|
|
|
#92146 - 2003-06-12 05:27 PM
Re: Detecting USB/Parallel port devices
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
i've modified WMIQuery a little, to apply a filter to the result. but it isn't compatable to old version. So a made a new UDF code:
$myArray = WMIQueryfilter("Description","Win32_PnPEntity",,"USB") for each $device in $myArray ? $device next
;**************************************************************************************************** FUNCTION WMIQueryfilter($what,$from,optional $computer,optional $where) dim $strQuery, $objEnumerator, $value, $item, $ubound dim $temp[0]
$strQuery = "Select " + $what + " From "+ $from if not $computer $computer="@WKSTA" endif $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer") $objEnumerator = $SystemSet.ExecQuery($strQuery) if @error exit 1 return endif For Each $objInstance in $objEnumerator If @Error = 0 and $objInstance <> "" $=execute("$$value = $$objInstance.$what") Select case VarType($value) & 8192 for each $item in $value $ubound = ubound($temp) if instr($item,$where) if $temp[$ubound] >' ' $ubound = $ubound +1 redim preserve $temp[$ubound] endif $temp[$ubound] = $item endif next case 1 $ubound = ubound($temp) if instr($value,$where) if $temp[$ubound] >' ' $ubound = $ubound +1 redim preserve $temp[$ubound] endif $temp[$ubound] = $value endif EndSelect EndIf Next $WMIQueryfilter = $temp ENDFUNCTION
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 781 anonymous users online.
|
|
|