Looking for a way to detect USB printers, scanners, and keyfobs

Started by Me

I've tried various WMI queries without success.

Appreciate any assistance.
SoftPerfect Support forum - Andrew avatar image

Re: Looking for a way to detect USB printers, scanners, and keyfobs   21 September 2014, 09:37

Sorry, I am not aware of any easy way to enumerate USB devices remotely.

Re: Looking for a way to detect USB printers, scanners, and keyfobs   22 September 2014, 11:02

Here is how you can get local attached printers remotely. You can modify the script in the link below to be used with NetScan. I have used a script like this in the past and it worked very well. -WS

http://blogs.technet.com/b/heyscriptingguy/archive/2006/08/14/how-can-i-list-all-the-printers-on-a-remote-computer.aspx
Looking for the output to be within NetScan, as a column I can copy from. Something that dumped to Excel or CSV could also work I suppose, outside of NetScan.
I have hundreds of machines to do, and it is every time we get a new client/customer. So I am auditing thousands of machines every year, across disparate environments sad

Re: Looking for a way to detect USB printers, scanners, and keyfobs   23 September 2014, 09:52

@Me, you can have the VBScript export it to a file. There are many examples on the net on how to do this. I know the Printers and the USB information is stored in the Registry, you could query the registry keys with NetScan??? That might give you what you need. -WS

Re: Looking for a way to detect USB printers, scanners, and keyfobs   23 September 2014, 09:56

@Me, another thought, if you all your clients are Windows 7 or better you could just write a PowerShell script to give you all the information you want from any or all clients. Might want to do that would be extremely fast and you can store it in a CSV file directly from the PowerShell Script. (Windows XP and Vista machines would be touch and go, depending if they have PowerShell setup on them or not) -WS
SoftPerfect Support forum - Andrew avatar image

Re: Looking for a way to detect USB printers, scanners, and keyfobs   23 September 2014, 10:43

Quote

Me

Looking for the output to be within NetScan, as a column I can copy from.


Then why you don't just run this WMI query in NetScan?
SELECT Caption FROM Win32_Printer
or
SELECT Caption FROM Win32_Printer WHERE PortName LIKE "USB%"
This seems to work great for USB printers - thank you:
SELECT Caption FROM Win32_Printer WHERE PortName LIKE "USB%"

This almost works for finding USB thumb drives - it seems to return a bit of junk though:
SELECT Caption FROM Win32_DiskDrive WHERE InterfaceType = 'USB'
Sample 'junk' response:
Generic- Compact Flash USB Device, Generic- MS/MS-Pro USB Device, Generic- SD/MMC USB Device, Generic- SM/xD-Picture USB Device

Stumped on finding sample WMI to run within NETSCAN for USB attached scanners though ( AKA 'imaging devices' )
This WMI is closer, but not sure how to (or if I can) do an inline filter to exclude the built-in USB matches.
SELECT Caption FROM Win32_USBHub WHERE DeviceID like 'USB\\\\%'
For example, excluding "USB Root Hub" and only seeing that Logitech device. Screenshot:

SoftPerfect support forum
SoftPerfect Support forum - Andrew avatar image

Re: Looking for a way to detect USB printers, scanners, and keyfobs   25 September 2014, 09:55

In the same way using the LIKE operator
SELECT Caption FROM Win32_USBHub WHERE NOT Caption LIKE '%root hub%' AND NOT Caption LIKE '%generic%' AND NOT Caption LIKE '%composite device%'
Thanks to Andrew, this one helps with taking out the stuff one might not be interested in.

For some reason it does not work on a scanner that I know is installed/connected:

SELECT Caption FROM Win32_USBHub WHERE NOT Caption LIKE '%root hub%' AND NOT Caption LIKE '%generic%' AND NOT Caption LIKE '%composite device%' AND NOT Caption LIKE '%usb mass%' AND NOT Caption LIKE '%usb printing%'

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

  ******    ********   **     **  **        **    ** 
 **    **   **     **   **   **   **         **  **  
 **         **     **    ** **    **          ****   
 **   ****  **     **     ***     **           **    
 **    **   **     **    ** **    **           **    
 **    **   **     **   **   **   **           **    
  ******    ********   **     **  ********     **    

Message: