Cannot detect USB Printer non admin account

V Vedsatx Saddvv 2 years 11 months ago
36 5 0

Hi All

When calling the GetZebraDriverPrinters method in UsbDiscoverer on Windows .Net I am finding that it only detects printers when the application is running with administrator permissions or with a local admin account. As soon as I run it under a domain account that has restrictions that cannot be overridden then I find that it cannot detect a local printer even though the user is able to see the printer installed via its driver and send test prints from the Control Panel's Devices and Printers window.

Does the LinkOS SDK make use of a different mechanism that is impacted by the user account's privilege level and how can I override this?

Kind regards

Please register or login to post a reply

5 Replies

M Masood Sujau

Hi Alexander
Thanks for your response. What class should I be using to use the driver and avoid the windows security issue?
I can manually create DiscoveredPrinterDriver objects by using the code below:
List printers = new List();
string query = "SELECT * from Win32_Printer";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection collection = searcher.Get();
foreach (ManagementObject printer in collection)
{
string name = printer.Properties["Name"].Value.ToString();
string driverName = printer.Properties["DriverName"].ToString();
string port = printer.Properties["PortName"].ToString();
var driver = new DiscoveredPrinterDriver(name, driverName, new List() { port });
printers.Add(driver);
}
but when the user picks a printer and then tries to connect to get the status I get an can not connect error for local accounts
DiscoveredPrinterDriver discoveredPrinter = User picked printer from the above list
Connection connection = discoveredPrinter.GetConnection();
connection.Open();
if (connection.Connected)
{
var printer = ZebraPrinterFactory.GetInstance(PrinterLanguage.ZPL, connection);
PrinterStatus status = printer.GetCurrentStatus();
}
Is there another way to connect and get the status? Can you please point me at some documentation for using driver based connections?
Cheers
Masood

A Alexander Palchikov

Hello Masood,
It's mainly a Windows security issue.  Windows is blocking use of the USB HID interface to non admin users.  There may be settings in the account that can be adjusted to allow for direct USB, but there isn't much that can be done in the SDK.  The only other option is to switch the connection type to Driver rather than direct USB.  There are limitations to the driver interface, mainly speed, but it will allow for USB connections that should be able to get past the Windows security properly.
 
Alexander PalchikovSoftware Engineer, Kutir MobilityPosted on behalf of Zebra Technologies

M Masood Sujau

Did you manage to find a solution? I am having the same issue.

R Ruth Neessen

Hi there,
i have the same problem. I'm using windows 10 and zebra link_os sdk v2, our printer is GK420t. We need to print via usb, because the our working place is not connected to the network.
I tried it in Java and in C#: if I am logged in as admin, I can print without problems from my Java or C# program. But once a standard user with restricted privileges is logged in under windows (which is usually the case), I can no longer print. The getZebraDriverPrinters() method still returns the printer, but a connection can no longer be established.
However, via the normal Windows Print dialog it is possible to print a test page, even with the restricted user.
Is there a solution?
Yours sincerely,
Ruth Neeßen

D Dmitry Prokhorov

Hello Peter,

Are you able to communicate with printer using ZebraDesigner tool that is running it under a domain account? Could you please to check it.

Dmitry Prokhorov
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies

CONTACT
Can’t find what you’re looking for?