Question Redirect Print To Similar (Duplicate) Printer

SiamIT

Well-known member
Joined
Aug 3, 2021
Messages
53
Programming Experience
5-10
Greetings..

here is the issue with the printer.. i (my client) is facing..

Say i have printer, setup and connected with the following name:
MY_BEST_Printer

The issue comes in when I unplug the USB cable and after some time plug, it back in it windows adds a new duplicate copy of the same printer.

MY_BEST_Printer (Copy 1)

And if I keep plugging and unplugging it keeps adding new duplicates.
MY_BEST_Printer (Copy 1)
MY_BEST_Printer (Copy 2)
MY_BEST_Printer (Copy 3)

and as few important app is setup to use the default printer name, so, when end user print using those app, it doesn't print anything as that printer is not the connected on, may be the copy 1 or copy N is connected/active one ..

so? my task is to create a script so that, it can handle the duplicate issue so that the printing from those application works fine..

WHAT I HAVE TRIED?

i have tried.. following.. using WMI service/functions
my script periodically checks for new copy (x) printer, if it found then delete the default/main printer and rename the copy - 1 to Base Name. But that does not solve the problem.

so, i am looking for a better idea that can work ?

i have looked into few Virtual Printer Driver, but that also seems not to have what i need for this purpose..

what i need is when user send print command to "MY_BEST_Printer" and if currently connected printer is duplicated at "MY_BEST_Printer (Copy - 3)" it will redirect/forward the print job to copy -3 named printer.

i think it will not be hard to handle, as both printer is same.. just forwarding the spool file or print job would be suffice?

but question is how? as i don't know how to do that :(

Note: Please don't suggest to say end user just to change the printer name form the app. As those app are kiosk app and not settings is available to end users. Only admins can change.

any help will be highly appreciated :)

thanks in advance
 
Do you control the source code of the app that is trying to print? Why are you trying to attack this via scripting? As an aside C# code is call code, not scripts.
 
Do you control the source code of the app that is trying to print?

nope, that is not open source app.

Why are you trying to attack this via scripting?

attack? i am sorry? attacking what/how? i didn't get your point..

and yes i am try do develop a c# based tool (service) that will run in background and handle the situation..

however, thanks a lot for your reply..

best regards
 
"attack" as in "attack the problem". Or perhaps a less colloquial phrasing: "approach the problem".
 
Hmmm... I tried unplugging my printer, waiting a while, and then plugging it back in to the same USB port, and I got the same printer name. The only time I started getting the copies was if I plugged into a different USB port, or if I had the printer connected via the network instead of directly to the machine.
 
Hmmm... I tried unplugging my printer, waiting a while, and then plugging it back in to the same USB port, and I got the same printer name. The only time I started getting the copies was if I plugged into a different USB port, or if I had the printer connected via the network instead of directly to the machine.

wow! you even tried to mimic the problem at your end. so? any possible solution using c# to redirect the print?
 
When I used to work for the Windows 7 printer team, we would have resolved this issue as by design because plugging into a different port, or connecting via the network with a different IP address effectively make the device basically look like a new device because it would get a different device ID. That was over 10 years ago when I used to work for that team, and it's why I was puzzled by your problem because I recall as developer I did a lot of plugging and unplugging of printers to make sure that PnP worked correctly. I really doubted that Windows 10 would have that major of a regression. I was happy to find that no regression exists. Why can't you just tell the kiosk owner to always plug the device back into the same port?
 
Why can't you just tell the kiosk owner to always plug the device back into the same port?

because i am not sure and also don't think that client didn't try to use the same port already..

there could be other reason that windows making duplicate printers :(

again thanks a lot for being so helpful to me..
 
Are you making sure nothing is currently queued before performing the deletes?

How are you performing the deletes?

Are you doing a reboot after the deletes?
 
Are you making sure nothing is currently queued before performing the deletes?

How are you performing the deletes?

Are you doing a reboot after the deletes?

thanks again for your replies.. here is your replies

1. nothing is queued
2. using wmi script, if you like to see the code i can share..
3. nope.. is it required?

besides:
it's look like following software can redirect from any printer to any

i check their youtube video..

here is their video link:


and i just need something very similar to that to forward/redirect printing..

best regards
 

Latest posts

Back
Top Bottom