Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.


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?


share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.