/build/static/layout/Breadcrumb_cap_w.png

Custom SQL Statement for locating computers with USB printers.

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!


0 Comments   [ + ] Show comments

Answers (1)

Answer Summary:
Posted by: dugullett 11 years ago
Red Belt
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)


Comments:
  • I'll try this thanks so much! - iandizon 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ