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!
Answers (1)
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 12 years ago