All,

I currently have a samba printer shared at \\%ServerIP%\Printer1 which requires credentials to connect.

Users can easily add the printer with the printer wizard. However, the printer will stop working after a day or two on Windows machines.

To combat this problem, I would like to add the printer each time a user logs on with a script. I have tried this:

echo Adding Printer1 at %ServerIP%

rundll32 printui.dll PrintUIEntry /in /n\\%ServerIP%\Printer1

echo Restarting print spooler so that printer is accessible in dialogs

start /wait sc stop spooler
start /wait sc start spooler

echo Done. Exiting...

But this doesn't work if the printer isn't already installed. How can I make a more robust solution?

Thanks!

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.