Jump to content

[Unresolved] How to determine if specific device is running?


Recommended Posts

Hi All,

For one of my scripts I have to determine if a USB device is installed, connected, and running. Is this possible without the use of DevCon as I do not have the liberty to install it on the scripted computer.

Thanks

-1

Edited by Negative1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

several different techniques, some that depend on what types of devices you're trying to find. Drives can be scoped out w/ the DriveGet... commands, for example.

if you're looking for full usb bus enumeration, i would suggest you google same.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Hi All,

For one of my scripts I have to determine if a USB device is installed, connected, and running. Is this possible without the use of DevCon as I do not have the liberty to install it on the scripted computer.

Thanks

-1

have a look at this device management UDF by weaponx

filter the results as the example shows for your target device

#include "DeviceAPI.au3"

;debug(_DeviceAPI_GetClassArray())
;exit

;--------------------------------------------------------
; EXAMPLE 1 - Build list of all devices from all classes
;--------------------------------------------------------
;#cs
;Build list of ALL device classes
_DeviceAPI_GetAllDevices()
Local $string
;Loop through all devices by index
While _DeviceAPI_EnumDevices()
If _DeviceAPI_GetDeviceRegistryProperty($SPDRP_ENUMERATOR_NAME) == "USB" Then
    If NOT StringInStr(_DeviceAPI_GetDeviceRegistryProperty($SPDRP_DEVICEDESC), "Hub") Then

    $string = "+"& _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DEVICEDESC) & @CRLF
    $string &= "Class Name: " & _DeviceAPI_GetClassName(_DeviceAPI_GetDeviceRegistryProperty($SPDRP_CLASSGUID)) & @CRLF
    $string &= "Class GUID: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_CLASSGUID) & @CRLF
    $string &= "Hardware ID: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_HARDWAREID) & @CRLF
    $string &= "Unique Instance ID: " & _DeviceAPI_GetDeviceId() & @CRLF
    $string &= "Manufacturer: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_MFG) & @CRLF
    $string &= "Driver: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DRIVER) & @CRLF
    $string &= "Friendly Name: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_FRIENDLYNAME) & @CRLF
    $string &= "Physical Device Object Name: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_PHYSICAL_DEVICE_OBJECT_NAME) & @CRLF
    $string &= "Upper Filters: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_UPPERFILTERS) & @CRLF
    $string &= "Lower Filters: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_LOWERFILTERS) & @CRLF
    $string &= "Enumerator: " & _DeviceAPI_GetDeviceRegistryProperty($SPDRP_ENUMERATOR_NAME) & @CRLF
    $string &= @CRLF
    EndIf
EndIf
    ConsoleWrite($string)
WEnd

_DeviceAPI_DestroyDeviceInfoList() ;Cleanup for good measure

I see fascists...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...