Application started from a "win services" doesn't see network pri



Env = win2000 SP3
Here is my scenario :
Our app start as a service : It extract data from a db and print to
The service is started with a particular user let say "user1".
Then we reboot the server :
If the net printers were installed before after a rebbot they are not
So we try to connect the net printer in our with "rundll32
printui.dll,PrintUIEntry /q /in /n "\\Server\NamePrinter".
It recreate the printer but for a default user .
This could give two same printer for the same user : and a problem for us.

Here is my two questions :
- How can I connect a printer for a specified user when a console session
isn't logged.
- Or how can I define the printer for all the user


thank you for your concern :
I've read the link you sent and notice the /ga in the command, it's worse.

here another try to explain my prob.
1 step : on the srv1 the Admin install a printer print1 ( on
\\pcuser\print1 )
2 step : execution on srv1 the background process enumerate printers -> no
net printer , I try to connect printui.dll,PrintUIEntry /in /n
\\pcuser\print1 ok it print.
3 step : next print job find 2 printers "\\pcuser\print1" > ????
4 step : the admin log on sev1 all he can do is delete the printers and
goto step1 ;(

printui.dll,PrintUIEntry /ga /n \\pcuser\print1 seem to fail I don't know
why ?
I've also tried it in interactive mode : the spooler fail need to be

Bruce Sanderson

You might try adding the "network printer" as a "Local Printer" per
instructions in I
suspect that at least part of the issue is that "Network Printers" are a per
user thing configured in the user's profile. When something runs as a
Service, there is no "user profile".

However, a Service should be able to use an existing Local Printer.

I suspect having a Service adding a printer each time it runs would be not a
good thing to do.

Bruce Sanderson MVP Printing

It is perfectly useless to know the right answer to the wrong question.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question