Hello, I was wondering if anyone can help me create a custom sql statement for finding computers with usb printers. We need to push out a usage monitor program for these computers and it would be nice if I could use the kbox to find these computers. I know when I look under inventory information the printers show up. How can I use this information?

Thanks in advance!

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

This will work to find the printers. To determine if they are USB or not I would think that would require a custom inventory rule.

SELECT NAME, IP, USER_LOGGED, PRINTERS

FROM MACHINE M

ORDER BY NAME

You could try something like this with Powershell. I've only tested this with my XPS printer, but you should be able to change XPSPort: to USB and get the result you need (sorry don't have a local printer). This will output to a .txt file then you can have Kace inventory that .txt file. You can then write a report based on this custom inventory data.

$compname= gc env:computername

$file= "c:\temp\file.txt"

gwmi -computer $compname Win32_Printer |where {$_.portname -eq "XPSPort:"}| Select-Object DeviceID,DriverName, PortName | Format-List|Out-File $file

 

Custom Inventory Rule:

ShellCommandTextReturn(cmd.exe /c type c:\temp\file.txt)

Answered 09/21/2012 by: dugullett
Red Belt

  • I'll try this thanks so much!
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share